Getting started

64 views
Skip to first unread message

asmith....@gmail.com

unread,
Oct 22, 2018, 3:02:02 AM10/22/18
to Accelerate
Hi, 
Here's an query with the basic stuff trying to run the Get Started program.

I change the stack.yaml as described, and put the code into the Main.hs. Since I'm using stack exclusively I'll stick with the stack files and commands.

On running command "stack ghci" a couple of times I found I had to put : 
"- accelerate" in dependencies in the package.yaml file, (no surprise there, it needs the package)
"- accelerate-1.2.0.1" in extra-deps in the stack.yaml.  (suggested by stack)

Before this neither import was working. Now "import Data.Array.Accelerate" works ok, but there's still an
error with the second import: Could not find module ‘Data.Array.Accelerate.LLVM.Native’

How do I get this module picked up properly?

As a side note I've had exactly the same thing on two machines running Ubuntu and Win10. The Win10 machine is my real target as it has a reasonable graphics card. I tried this on my Ubuntu laptop with integrated graphics just to see if it was a Win specific issue - apparently not.

Thanks
Adam

Trevor McDonell

unread,
Oct 22, 2018, 3:10:48 AM10/22/18
to accelerat...@googlegroups.com

Hi Adam,

That module is available from the package accelerate-llvm-native, while the GPU backend is available in accelerate-llvm-ptx. It is strange that stack didn’t mention that you need this package though, it usually does for me \:

Since you mention that you are running on windows, I should mention that the CPU backend doesn’t currently work on windows (see #395) but the GPU backend should work.

Hope that helps!
-Trev


--
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.
Visit this group at https://groups.google.com/group/accelerate-haskell.
For more options, visit https://groups.google.com/d/optout.

asmith....@gmail.com

unread,
Oct 22, 2018, 6:00:41 AM10/22/18
to Accelerate
Hi Trevor
Ah yes, I see now the info does indeed say the additional components are separate packages, and I've put them in package.yaml dependencies. Also I'll stick with GPU for Windows then, thanks I didn't see that anywhere.

Unfortunately I still can't get it running (Ubuntu CPU flavour). There's were lots of version dependency errors/exceptions. Now here's where I don't know what I'm doing, but I tried manually changing the versions in the stack.yaml extra deps. In the end repeatedly settling each to the latest suggested version in the hope of compatibility, and adding a couple of things it seemed to be asking for, ending with this:
extra-deps:
- 'accelerate-llvm-1.2.0.0'
- 'accelerate-llvm-native-1.2.0.0'
- 'accelerate-llvm-ptx-1.2.0.0'
- 'cuda-0.10.0.0'
- 'llvm-hs-6.0.0'
- 'llvm-hs-pure-6.0.0'
- accelerate-1.2.0.0     (addition)
- nvvm-0.9.0.0            (addition)

At this stage "stack ghci" gives:
"Error:
--  While building custom Setup.hs for package llvm-hs-6.0.0 using:
... Lots of items here ..."

Then it actually does compile but then fails with:
"setup: The program 'llvm-config' version ==6.0.* is required but it could not
    be found.

Warning: Build failed..."

Any pointers you could give would be great. I've probably gone down the wrong path here.
Thanks
Adam

Trevor McDonell

unread,
Oct 23, 2018, 9:08:55 AM10/23/18
to accelerat...@googlegroups.com
Hey Adam,

It might be best to open a ticket on github, that way you can post the entire stack.yaml etc. In particular, which resolver are you using? lts-12.* should work fine, though nightly will be a bit problematic, for example.

If you are having trouble installing `llvm-hs`, it might be a problem with your installation of the llvm tools? On your ubuntu machine at least you can get those via apt.llvm.org.

Cheers,
-Trevor

P.S. Sorry for the slow replies, I'm travelling right now but will do my best to respond when I can.


--

asmith....@gmail.com

unread,
Oct 23, 2018, 11:19:56 AM10/23/18
to Accelerate
Hi Trevor
Thanks for that. I tried it on the windows machine. However I'm not sure if either the Cuda or LLVM installs went correctly as neither seem accessible from Visual Studio. The gory details are that Cuda has an odd issue of not installing the Visual Studio bit while an up to date driver is installed:

So this is not fixed in Cuda 10. I tried the install without VS integration, then fix it up after method. It may be VS integration is irrelevant, but I don't now.

LLVM's Getting Started with the LLVM System using Microsoft Visual Studio page gives a complex process, though I don't know what subset is sufficient for Accelerate usage. And I only saw this page existed after running the Win installer.

Anyway I tried various stack ghci tries on the Get Started Accelerate program. It errors with:
No packages found in snapshot which provide a "llvm-config" executable, which is a build-tool dependency of "llvm-hs"

Some dependency conflicts/exceptions appear after that, but I take it to mean at least that LLVM is not installed correctly.

Sadly I've spent enough time on it now. There's too many unknowns and moving parts and issues for me that I can't invest further time. Maybe Ill try in the future. Thanks for the help anyway.
Adam

Trevor McDonell

unread,
Oct 30, 2018, 10:53:00 AM10/30/18
to accelerat...@googlegroups.com
Hi Adam,

Sorry it didn't work out for you, and that I couldn't be more help.

I actually don't own a windows machine, so it is difficult for me to provide advice on how to best set up visual studio etc. I do try and keep the windows CI builds working, and have a virtual machine setup (somewhere..?), though I accept that the instructions are probably out of date and can be more detailed. Mostly, I rely on open source contributions to help with building on windows.

No packages found in snapshot which provide a "llvm-config" executable, which is a build-tool dependency of "llvm-hs"

This isn't an error, I get this message as well: it just means that cabal doesn't know anything about how to install LLVM, so you must install it yourself.

Anyway, sorry again to hear things didn't work out for you, I hope I didn't waste too much of your time ):

Cheers,
-Trevor


asmith....@gmail.com

unread,
Oct 31, 2018, 9:39:18 AM10/31/18
to Accelerate
Thanks Trevor. Re Windows: indeed my own machine is a Linux laptop, and I'm only using the Windows desktop as it has much better specs including a fair graphics card.

Regarding the cabal install you mention, I thought the Getting Started sections 2.1 for cabal and 2.2 for stack were one or the other, but your saying that a cabal install LLVM is also needed when using stack? I thought the extra-deps in a stack.yaml was precisely for packages like accelerate that are in Hackage but not Stackage. Aren't there problems cabal installing and also using stack?, e.g. I understand cabal is not per project.

In fact I didn't need LLVM or anything to be usable from Visual Studio, as I can use my Haskell outside of all that. I was just experimenting to try and gather info and make some progress. There seems to be other Windows issues though, like the odd CUDA one I mentioned.

You mention your having a Windows VM. That makes me think I can run my project on a Ubuntu VM on the Windows machine. Does all the parallel graphics card goodness still work on a VM? I could move to a Linux dual boot later perhaps. I've also just seen that you've put an image up on Docker Hub, so I could run that in the Ubuntu VM if that's feasible or an easier alternative.

By the way the context of all this is a home project to analyse the viability of one of the stablecoin cryptocurrencies (i.e. one designed to maintain a value peg with another currency). I have my maths model all worked out and (my first) Haskell program written (not parallel yet though). The Monte Carlo simulations are quite demanding though, prompting the use of Accelerate. Turns out I can't really drop the project, though I have less time now. Apologies if the previous post sounded a tad peevish - you know how online magically magnifies everything.

Cheers
Adam



Trevor McDonell

unread,
Oct 31, 2018, 11:00:04 AM10/31/18
to accelerat...@googlegroups.com
Hey Adam,

On Wed, 31 Oct 2018 at 14:39 <asmith....@gmail.com> wrote:
Thanks Trevor. Re Windows: indeed my own machine is a Linux laptop, and I'm only using the Windows desktop as it has much better specs including a fair graphics card.

Regarding the cabal install you mention, I thought the Getting Started sections 2.1 for cabal and 2.2 for stack were one or the other, but your saying that a cabal install LLVM is also needed when using stack? I thought the extra-deps in a stack.yaml was precisely for packages like accelerate that are in Hackage but not Stackage. Aren't there problems cabal installing and also using stack?, e.g. I understand cabal is not per project.

Correct, you only need to follow either 2.1 or 2.2.

What I meant was, cabal/stack know how to install executables if they are available via Hackage, for example the executable 'happy' is provided by the package of the same name, so it'll install that package when another says that it depends on the executable 'happy'. But, for other executables such as 'llvm-config' which don't appear on Hackage, you'll get the warning you see. It is safe to ignore: cabal/stack will just require the executable to be on the PATH.

In fact I didn't need LLVM or anything to be usable from Visual Studio, as I can use my Haskell outside of all that. I was just experimenting to try and gather info and make some progress. There seems to be other Windows issues though, like the odd CUDA one I mentioned.

I don't think I've ever tried with visual studio integration, so can't say, sorry...
 
You mention your having a Windows VM. That makes me think I can run my project on a Ubuntu VM on the Windows machine. Does all the parallel graphics card goodness still work on a VM? I could move to a Linux dual boot later perhaps. I've also just seen that you've put an image up on Docker Hub, so I could run that in the Ubuntu VM if that's feasible or an easier alternative.

Last time I tried you can not access the GPU through the virtual machine. That was a while ago, so maybe that situation has changed, but I rather doubt it. IIRC that was using virtual box. Other VMs may support this, but I don't know.

For the docker images you can access the GPU, if you use the nvidia-docker wrapper. There are a few extra prerequisites to getting it to work though, but check it out:


By the way the context of all this is a home project to analyse the viability of one of the stablecoin cryptocurrencies (i.e. one designed to maintain a value peg with another currency). I have my maths model all worked out and (my first) Haskell program written (not parallel yet though). The Monte Carlo simulations are quite demanding though, prompting the use of Accelerate. Turns out I can't really drop the project, though I have less time now. Apologies if the previous post sounded a tad peevish - you know how online magically magnifies everything.

I didn't think you sounded peeved, I was just disappointed that it didn't work out for you and that you wasted a bunch of your time.

I'd suggest getting started on your linux box with the CPU backend. That should be pretty straightforward to install (you can grab LLVM via apt) and start writing a proof-of-concept of your program. If that goes well you can revisit trying to install in windows to run on the GPU.

Cheers,
-Trev
Reply all
Reply to author
Forward
0 new messages