AccelerateHS / accelerate

Embedded language for high-performance array computations
https://www.acceleratehs.org
Other
888 stars 119 forks source link

Unspecified Launch Failure with examples #99

Closed ndaniels closed 10 years ago

ndaniels commented 11 years ago

This is on Mac OS X 10.8.4, on a Retina Macbook Pro with CUDA 5.0.61 installed.

It's worth noting that I can run NVIDIA's CUDA examples just fine (such as particles).

The accelerate-quickcheck example fails as follows:

accelerate-quickcheck cuda accelerate-quickcheck (c) 2012 The Accelerate Team

Usage: accelerate-quickcheck [BACKEND] [OPTIONS]

Available backends: interpreter reference implementation (sequential)

map: Int8: DIM0: abs: [Failed] accelerate-quickcheck: * Internal error in package accelerate-cuda * *\ Please submit a bug report at https://github.com/AccelerateHS/accelerate/issues ./Data/Array/Accelerate/CUDA.hs:139 (unhandled): CUDA Exception: invalid argument

The accelerate-mandelbrot example fails with a different CUDA exception:

accelerate-mandelbrot: * Internal error in package accelerate-cuda * *\ Please submit a bug report at https://github.com/AccelerateHS/accelerate/issues ./Data/Array/Accelerate/CUDA.hs:139 (unhandled): CUDA Exception: unspecified launch failure

I do have my DYLD_LIBRARY_PATH set to the place the CUDA stuff is installed (/Developer/NVIDIA/CUDA-5.0/lib)

tmcdonell commented 11 years ago

I also have an rMBP and CUDA 5 installed, so we should be able to get this working (:

First thing I would try: are relying on dynamic graphic switching? If so you might have some issues (#67). I have noted some workarounds (7b29296668761b8539a0799c5ace06e5d94d153f), tl;dr: get gfxCardStatus http://gfx.io

ndaniels commented 11 years ago

On Jun 24, 2013, at 8:14 PM, "Trevor L. McDonell" notifications@github.com wrote:

I also have an rMBP and CUDA 5 installed, so we should be able to get this working (:

Here's hoping so!

First thing I would try: are relying on dynamic graphic switching? If so you might have some issues (#67). I have noted some workarounds (7b29296), tl;dr: get gfxCardStatus http://gfx.io

I already use gfxCardStatus, and have tried this both ways; it doesn't make a difference. And, the standalone CUDA examples work even with dynamic switching on.

tmcdonell commented 11 years ago

hmm... accelerate-quickcheck might not work with 8-bit types (#58, I haven't checked in a while), but the other example programs like accelerate-nbody should definitely work.

Simpler test, do the CUDA bindings themselves work? In ghci -fno-ghci-sandbox +RTS -V0:

> import Foreign.CUDA.Driver
> dev <- device 0
> ctx <- create dev []
> ptr <- newListArray [1..10] :: IO (DevicePtr Float)
> peekListArray 10 ptr

If so, try a simpler Accelerate program?

import Prelude                          as P
import Data.Array.Accelerate            as A
import Data.Array.Accelerate.CUDA

import System.Environment

xs, ys :: Acc (Vector Float)
xs = use $ fromList (Z:.10) [0..]
ys = use $ fromList (Z:.10) [2,4..]

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

main :: IO ()
main
  = withArgs ["-ddump-cc", "-ddump-gc", "-ddump-exec", "-dverbose"]
  $ print
  $ run (dotp xs ys)
tmcdonell commented 11 years ago

You might also wish to try the github versions of accelerate and accelerate-cuda, although I don't think the delta between those and the latest Hackage versions is significant.

ndaniels commented 11 years ago

On Jun 25, 2013, at 12:50 AM, "Trevor L. McDonell" notifications@github.com wrote:

hmm... accelerate-quickcheck might not work with 8-bit types (#58, I haven't checked in a while), but the other example programs like accelerate-nbody should definitely work.

Simpler test, do the CUDA bindings themselves work? In ghci -fno-ghci-sandbox +RTS -V0:

import Foreign.CUDA.Driver dev <- device 0 ctx <- create dev [] ptr <- newListArray [1..10] :: IO (DevicePtr Float) peekListArray 10 ptr If so, try a simpler Accelerate program?

Nope, this fails almost immediately:

Prelude Foreign.CUDA.Driver> dev <- device 0 Loading package bytestring-0.9.2.1 ... linking ... done. Loading package cuda-0.5.0.2 ... linking ... done. *\ Exception: CUDA Exception: driver not initialised

Any idea what might be wrong?

tmcdonell commented 11 years ago

oh oops; forgot to include initialise [] as the first command. Sorry! Please try again?

ndaniels commented 11 years ago

On Jun 25, 2013, at 6:46 PM, "Trevor L. McDonell" notifications@github.com wrote:

oh oops; forgot to include initialise [] as the first command. Sorry! Please try again?

With that, it works. And, the simple example you gave me works as well. Its output is: Array (Z) [660.0]

best, Noah

tmcdonell commented 11 years ago

huh. okay... any progress on accelerate-nbody?

Try installing in debug mode (cabal install accelerate-cuda -fdebug) and running as: accelerate-nbody -- -dverbose -ddump-cc -ddump-exec -ddump-gc +RTS -V0 (warning: chatty).

If that works try running again dropping the RTS opts (I've never needed to use it except in the dynamic switching case, but worth a shot I guess).

ndaniels commented 11 years ago

On Jun 25, 2013, at 10:44 PM, "Trevor L. McDonell" notifications@github.com wrote:

huh. okay... any progress on accelerate-nbody?

I hadn't tried accelerate-nbody (my bug report was based on accelerate-mandelbrot). Interestingly, it looks like I hadn't tried to install accelerate-examples, which includes (I'm guessing) accelerate-nbody.

However, now I'm in cabal hell. accelerate-examples relies on cufft, which refuses to install.

cabal --extra-lib-dirs=/Developer/NVIDIA/CUDA-5.0/lib --extra-include-dirs=/Developer/NVIDIA/CUDA-5.0/include install cufft

complains that it can't find cufft.h, even though I can see it right there in /Developer/NVIDIA/CUDA-5.0/include

sigh any suggestions?

robeverest commented 11 years ago

On Wed, Jun 26, 2013 at 1:22 PM, Noah Daniels notifications@github.comwrote:

On Jun 25, 2013, at 10:44 PM, "Trevor L. McDonell" < notifications@github.com> wrote:

huh. okay... any progress on accelerate-nbody?

I hadn't tried accelerate-nbody (my bug report was based on accelerate-mandelbrot). Interestingly, it looks like I hadn't tried to install accelerate-examples, which includes (I'm guessing) accelerate-nbody.

However, now I'm in cabal hell. accelerate-examples relies on cufft, which refuses to install.

cabal --extra-lib-dirs=/Developer/NVIDIA/CUDA-5.0/lib --extra-include-dirs=/Developer/NVIDIA/CUDA-5.0/include install cufft

complains that it can't find cufft.h, even though I can see it right there in /Developer/NVIDIA/CUDA-5.0/include

sigh any suggestions?

Have you got /Developer/NVIDIA/CUDA-5.0/bin in your PATH? The autoconf script in cufft uses that to determine where to find cufft.h, something that we should probably find a better solution for.

— Reply to this email directly or view it on GitHubhttps://github.com/AccelerateHS/accelerate/issues/99#issuecomment-20025117 .

ndaniels commented 11 years ago

On Jun 25, 2013, at 11:33 PM, robeverest notifications@github.com wrote:

Have you got /Developer/NVIDIA/CUDA-5.0/bin in your PATH? The autoconf script in cufft uses that to determine where to find cufft.h, something that we should probably find a better solution for.

Well, I do, but the problem turns out to be that I also had an old, out of date, /usr/local/cuda/bin earlier in my PATH. Thus, it was using the wrong autoconf.

I'll investigate further; it could be that the weird cuda errors also stemmed from something like this.

tmcdonell commented 11 years ago

Oh, where did you get accelerate-mandelbrot from then?

Sounds like you might have several inconsistent CUDA installations floating around. Nasty... In my setup PATH doesn't have /Developer/NVIDIA/.... The CUDA installer script put the necessary symlinks into from /usr/local/cuda/ and I just use that. Either should be fine, but just pick one.

tmcdonell commented 11 years ago

The autoconf scripts (should) choose paths based on which nvcc they find.

ndaniels commented 11 years ago

On Jun 25, 2013, at 11:42 PM, "Trevor L. McDonell" notifications@github.com wrote:

Oh, where did you get accelerate-mandelbrot from then?

Unclear; possibly from an earlier botched installation of examples?

Sounds like you might have several inconsistent CUDA installations floating around. Nasty... In my setup PATH doesn't have /Developer/NVIDIA/.... The CUDA installer script put the necessary symlinks into from /usr/local/cuda/ and I just use that. Either should be fine, but just pick one.

I may be best off wiping out all the CUDA stuff and starting from scratch. But, I'm also encountering a cabal-hell issue: accelerate-examples wants bmp-1.2.3.1, which won't compile; 1.2.5.2 installs just fine. This is GHC 7.4.2.

If I can't make any progress with that, I'll rip out my entire Haskell installation and all the CUDA stuff, and install a fresh Haskell Platform and CUDA... :/

tmcdonell commented 11 years ago

Ugh, that sounds painful. I am sorry : I did check that it installed with 7.4.2 before release, but I'm not sure why cabal now refuses to find a suitable setup.

I believe the Haskell Platform has been updated with ghc-7.6. Installing that might be a gentler way to start again, without blowing away everything that already works. (Although, same amount of recompiling to be done)

ndaniels commented 11 years ago

On Jun 26, 2013, at 12:00 AM, "Trevor L. McDonell" notifications@github.com wrote:

Ugh, that sounds painful. I am sorry : I did check that it installed with 7.4.2 before release, but I'm not sure why cabal now refuses to find a suitable setup.

I believe the Haskell Platform has been updated with ghc-7.6. Installing that might be a gentler way to start again, without blowing away everything that already works. (Although, same amount of recompiling to be done)

You are correct; not sure how I missed that. Now I can use 7.6 and pine for a stable 7.8 :)

Thanks... not sure whether you want to close this bug or leave it in limbo; I will need a couple days to get everything set up with the new Platform and test things out.

tmcdonell commented 11 years ago

Limbo is fine (:

Hopefully things go a bit smoother for you from here on out. Keep us updated.

tmcdonell commented 10 years ago

Hi @ndaniels , any progress here?

ndaniels commented 10 years ago

Sorry, I thought I'd updated but apparently not.

Days weren't needed. Reinstalled everything, and everything works -- and I see the expected (massive) performance delta between interpreted and cuda!

Now to learn how to use it all, and maybe apply it to some problems in computational biology and cheminformatics.

Please close the ticket; thanks! If an explanation is needed, it seems that conflicting cuda installs coupled with conflicting accelerate installs (I'd first tried playing with accelerate during ICFP '12) caused breakage; cabal hell didn't help.

tmcdonell commented 10 years ago

Great!

Sounds like a cool application domain as well! I'm always interested to hear what people are using Accelerate for, so do stay in touch. There is a mailing list as well, if you have any problems: accelerate-haskell@googlegroups.com