Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mac OS X] n-body taking 100% of the CPU #82

Closed
adinapoli opened this issue Mar 4, 2013 · 9 comments
Closed

[Mac OS X] n-body taking 100% of the CPU #82

adinapoli opened this issue Mar 4, 2013 · 9 comments

Comments

@adinapoli
Copy link

Hi all,

probably this is related to #67, but if I run the accelerate-nbody I get an unresponsive graphical app which sucks up 100% of the CPU.

I believe is not even using the CUDA backend. Any thoughts/debugging methods/solutions?

@tmcdonell
Copy link
Member

100% CPU indeeds sounds like you are using the interpreter backend. A couple of things spring to mind:

  • when compiling the examples package, make sure you include the -fcuda flag to cabal. I have found that occasionally cabal silently decides to not use the CUDA backend even if accelerate-cuda is already installed.
  • run with accelerate-nbody --cuda to force the cuda backend: you'll get an error if it is not available.

Let me know if either of those help.

@adinapoli
Copy link
Author

Uhm, tried to reinstall the example, got this (inside accelerate-example folder):

cabal install -fcuda
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: accelerate-examples-0.13.0.0
trying: accelerate-examples-0.13.0.0:+opencl

whilst if I try to run nbody with that flag I get:

accelerate-nbody --cuda
Error: unrecognized option `--cuda'
Run "accelerate-nbody --help" for usage information

Yesterday I've also tried this command, forcing the interpreter:

accelerate-noby --interpreter cuda

But apparently nothing changed, the program used 100% of the CPU nevertheless o.O

Cheers,
Alfredo

tmcdonell added a commit to AccelerateHS/accelerate-examples that referenced this issue Mar 5, 2013
tmcdonell added a commit to AccelerateHS/accelerate-examples that referenced this issue Mar 5, 2013
@tmcdonell
Copy link
Member

Try cabal install -fcuda -f-opencl

I also pushed some patches that will display what backends are available and indicate which is currently being used, so it should be more obvious what is going on.

@adinapoli
Copy link
Author

Using cabal configure -fgui -fcuda does succeed, but the outcome is the same. I'll pull your juicy patches and keep you posted, thanks :)

A.

@adinapoli
Copy link
Author

Ok, interesting bits here. Running this fails (inside accelerate-examples):

cabal: Could not resolve dependencies:
trying: accelerate-examples-0.13.0.0
rejecting: bmp-1.2.4.1/installed-772... (conflict: accelerate-cuda =>
binary==0.5.1.1/installed-a36..., bmp => binary==0.6.4.0/installed-5bd...)
rejecting: bmp-1.2.4.1 (conflict: accelerate-cuda =>
binary==0.5.1.1/installed-a36..., bmp => binary==0.6.*)
trying: bmp-1.2.3.4
rejecting: accelerate-io-0.13.0.0/installed-fd4... (conflict: bmp==1.2.3.4,
accelerate-io => bmp==1.2.4.1/installed-772...)
rejecting: accelerate-io-0.12.1.0, 0.12.0.0 (conflict: accelerate-examples =>
accelerate-io>=0.13)

Usual run-of-the-mill cabal-hell errors I believe :) Tracking down the problem I've updated the accelerate-cuda pulling the latest and it does update binary but now I get:

Data/Array/Accelerate/CUDA/Analysis/Launch.hs:145:14:
    Not in scope: data constructor `Foreign'
Failed to install accelerate-cuda-0.13.0.0

..which solved itself updating the latest accelerate (sorry for the stream-of-thoughts-like, but I'm trying to document the process for whoever will have the same problem in the future :) )

Running a plain cabal install inside accelerate-examples succeed, but as we were suspecting nbody is using the sequential interpreter:

accelerate-nbody --interpreter cuda
accelerate-nbody (c) [2012..2013] The Accelerate Team

Usage: accelerate-nbody [OPTIONS]

Available backends:
  *  interpreter  reference implementation (sequential)

@adinapoli
Copy link
Author

Ok, new updates:

  • Installed latests version of accelerate, accelerate-cuda, accelerate-fft and accelerate-io
  • Reinstalled accelerate-examples with cabal install -fgui -fcuda -f-opencl
  • Run n-body with accelerate-nbody --cuda

Now finally the cuda implementation shows up, but...

accelerate-nbody (c) [2012..2013] The Accelerate Team

Usage: accelerate-nbody [OPTIONS]

Available backends:
     interpreter  reference implementation (sequential)
  *  cuda         implementation for NVIDIA GPUs (parallel)

accelerate-nbody:
*** Internal error in package accelerate-cuda ***
*** Please submit a bug report at https://github.com/AccelerateHS/accelerate/issues
./Data/Array/Accelerate/CUDA.hs:145 (unhandled): CUDA Exception: invalid argument

@tmcdonell
Copy link
Member

AH! You have made progress!
This is an instance of #80. If you update to the latest CUDA package on hackage (0.5.0.1) it should (hopefully, finally) work.

@adinapoli
Copy link
Author

Yes! Success!

Thans a lot :)
For who will come next, in case he might ever need it, this is the Mac OS X cuda lib directory, so this makes installing cuda a breeze. Posting here since I forgot about this path regularly :D

cabal install cuda --reinstall --force-reinstalls --extra-lib-dirs=/usr/local/cuda/lib/

A.

@tmcdonell
Copy link
Member

Great! Thanks also for the excellent write-up. I've added a link here from the troubleshooting section of the wiki as others might find this useful.

-T

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants