
Hi All. I've two question about Data Parallel Haskell. I'm trying some experiment using DPH and I've wrote a little program using the functions lengthP and mapP. I've imported the module GHC.PArr and I've informed the compiler that I want to use some language extension using the line {-# LANGUAGE PArr #-}. All works fine. Looking around I've saw that some code examples use {-# LANGUAGE PArr, ParallelListComp #-} instead. The my first question is: Which is the difference in using or not the extension ParallelListComp? Seems that my program works fine with or without this extension (if I omit the extension PArr I've some compilation errors). The second question is: Have I to use the option -threaded when compile my program? I'm using Haskell Platform (GHC 6.12.1) on MacOS X 10.6.3 Thanks in advance for any answer. Luca. _________________________________________________________________ http://clk.atdmt.com/UKM/go/197222280/direct/01/ Do you have a story that started on Hotmail? Tell us now

Hi Luca if you don't use (data parallel) list comprehensions you shouldn't need the {-# LANGUAGE ParallelListComp #-} annotation. Here's and example from the DPH page that uses them: dotp_double :: [:Double:] -> [:Double:] -> Double dotp_double xs ys = sumP [:x * y | x <- xs | y <- ys:] http://www.haskell.org/haskellwiki/GHC/Data_Parallel_Haskell If you are just using the DPH functionals mapP, zipP etc. {-# LANGUAGE PArr #-} should be all you need. GHC will need this extension to handle the [: :] type notation. I don't know about your second question, from the DPH page it looks like you need -threaded for multicore, but you can still run DPH code on single core (if you don't supply -threaded and link to the right library), see 1.5.6 Parallel execution. Best wishes Stephen

On Thursday 10 June 2010 13:28:36, Luca Ciciriello wrote:
Hi All.
I've two question about Data Parallel Haskell.
I'm trying some experiment using DPH and I've wrote a little program using the functions lengthP and mapP. I've imported the module GHC.PArr and I've informed the compiler that I want to use some language extension using the line {-# LANGUAGE PArr #-}. All works fine. Looking around I've saw that some code examples use {-# LANGUAGE PArr, ParallelListComp #-} instead.
Parallel list-comprehensions are something different from parallel arrays. I think it's not implied by PArr, so if you use both features, you need to specify both.
The my first question is: Which is the difference in using or not the extension ParallelListComp? Seems that my program works fine with or without this extension (if I omit the extension PArr I've some compilation errors).
Then you probably only use parallel arrays and not parallel list- comprehensions (which are just syntactic sugar for the families of zip[With]N functions).
The second question is: Have I to use the option -threaded when compile my program?
Would make sense. It wouldn't be able to profit from multiple cores without. Compile with -threaded and run with +RTS -Nk (for a reasonable value of k on your box).
I'm using Haskell Platform (GHC 6.12.1) on MacOS X 10.6.3
Thanks in advance for any answer.
Luca.
participants (3)
-
Daniel Fischer
-
Luca Ciciriello
-
Stephen Tetley