Re: [Haskell-cafe] Control.Parallel.Strategies

2008-04-11 Thread Cale Gibbard
Out of interest, have you tried using parListChunk to break the work
into larger pieces? It seems rather unlikely to help with this case as
the parts are already pretty large, but perhaps it's worth a shot.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Control.Parallel.Strategies

2008-04-11 Thread Sebastian Sylvan
On Fri, Apr 11, 2008 at 10:43 AM, Don Stewart <[EMAIL PROTECTED]> wrote:

> sebastian.sylvan:
> >On Wed, Apr 9, 2008 at 10:58 PM, Justin Bailey <[EMAIL PROTECTED]
> >
> >wrote:
> >
> >  On Wed, Apr 9, 2008 at 2:25 PM, Sebastian Sylvan
> >  <[EMAIL PROTECTED]> wrote:
> >  > Nope!
> >  >
> >  > This is GHC 6.8.2 btw, downloaded the binary from the web site,
> so
> >  it's
> >  > nothing strange.
> >
> >  On my hyper-threaded CPU, your original code works fine. With -N2,
> I
> >  see 100% CPU. With N1, only 50%. I am also using GHC [3]6.8.2.
> >  Justin
> >
> >Hmm, that's curious. I compile with "ghc --make -threaded partest.hs
> -o
> >par.exe", and then run it with "par.exe +RTS -N2 -RTS". Am I making
> some
> >silly configuration error?
> >Are you running this on windows?
> >
>
> I think its always worth using -O or -O2 too, for what its worth.
>
Yes I've tried both, neither helped.



-- 
Sebastian Sylvan
+44(0)7857-300802
UIN: 44640862
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Control.Parallel.Strategies

2008-04-11 Thread Don Stewart
sebastian.sylvan:
>On Wed, Apr 9, 2008 at 10:58 PM, Justin Bailey <[EMAIL PROTECTED]>
>wrote:
> 
>  On Wed, Apr 9, 2008 at 2:25 PM, Sebastian Sylvan
>  <[EMAIL PROTECTED]> wrote:
>  > Nope!
>  >
>  > This is GHC 6.8.2 btw, downloaded the binary from the web site, so
>  it's
>  > nothing strange.
> 
>  On my hyper-threaded CPU, your original code works fine. With -N2, I
>  see 100% CPU. With N1, only 50%. I am also using GHC [3]6.8.2.
>  Justin
> 
>Hmm, that's curious. I compile with "ghc --make -threaded partest.hs -o
>par.exe", and then run it with "par.exe +RTS -N2 -RTS". Am I making some
>silly configuration error?
>Are you running this on windows?
> 

I think its always worth using -O or -O2 too, for what its worth.

-- Don
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Control.Parallel.Strategies

2008-04-10 Thread Sebastian Sylvan
On Wed, Apr 9, 2008 at 11:10 PM, Justin Bailey <[EMAIL PROTECTED]> wrote:

> On Wed, Apr 9, 2008 at 3:03 PM, Sebastian Sylvan
> <[EMAIL PROTECTED]> wrote:
> > Hmm, that's curious. I compile with "ghc --make -threaded partest.hs -o
> > par.exe", and then run it with "par.exe +RTS -N2 -RTS". Am I making some
> > silly configuration error?
> >  Are you running this on windows?
>
> Yep, that's the command line I used and I am running XP.
>
> Justin
>


That is indeed weird. The only difference seems to be that you have
hyperthreading, whereas I have dual cores. But as I mentioned, manual
parallelism works (using forkIO)...

-- 
Sebastian Sylvan
+44(0)7857-300802
UIN: 44640862
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Control.Parallel.Strategies

2008-04-09 Thread Justin Bailey
On Wed, Apr 9, 2008 at 3:03 PM, Sebastian Sylvan
<[EMAIL PROTECTED]> wrote:
> Hmm, that's curious. I compile with "ghc --make -threaded partest.hs -o
> par.exe", and then run it with "par.exe +RTS -N2 -RTS". Am I making some
> silly configuration error?
>  Are you running this on windows?

Yep, that's the command line I used and I am running XP.

Justin
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Control.Parallel.Strategies

2008-04-09 Thread Sebastian Sylvan
On Wed, Apr 9, 2008 at 10:58 PM, Justin Bailey <[EMAIL PROTECTED]> wrote:

> On Wed, Apr 9, 2008 at 2:25 PM, Sebastian Sylvan
> <[EMAIL PROTECTED]> wrote:
> > Nope!
> >
> > This is GHC 6.8.2 btw, downloaded the binary from the web site, so it's
> > nothing strange.
>
> On my hyper-threaded CPU, your original code works fine. With -N2, I
> see 100% CPU. With N1, only 50%. I am also using GHC 6.8.2.
>
> Justin
>

Hmm, that's curious. I compile with "ghc --make -threaded partest.hs -o
par.exe", and then run it with "par.exe +RTS -N2 -RTS". Am I making some
silly configuration error?
Are you running this on windows?


-- 
Sebastian Sylvan
+44(0)7857-300802
UIN: 44640862
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Control.Parallel.Strategies

2008-04-09 Thread Justin Bailey
On Wed, Apr 9, 2008 at 2:25 PM, Sebastian Sylvan
<[EMAIL PROTECTED]> wrote:
> Nope!
>
> This is GHC 6.8.2 btw, downloaded the binary from the web site, so it's
> nothing strange.

On my hyper-threaded CPU, your original code works fine. With -N2, I
see 100% CPU. With N1, only 50%. I am also using GHC 6.8.2.

Justin
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Control.Parallel.Strategies

2008-04-09 Thread Sebastian Sylvan
On Wed, Apr 9, 2008 at 10:22 PM, Justin Bailey <[EMAIL PROTECTED]> wrote:

> 2008/4/9 Sebastian Sylvan <[EMAIL PROTECTED]>:
> > main = print $ parMap rnf fib $ take 80 $ randomRs (30,35) (mkStdGen
> 123)
>
> Does the strategy "rwhnf" do it for you?
>
> Justin
>


Nope!

This is GHC 6.8.2 btw, downloaded the binary from the web site, so it's
nothing strange.

-- 
Sebastian Sylvan
+44(0)7857-300802
UIN: 44640862
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Control.Parallel.Strategies

2008-04-09 Thread Justin Bailey
2008/4/9 Sebastian Sylvan <[EMAIL PROTECTED]>:
> main = print $ parMap rnf fib $ take 80 $ randomRs (30,35) (mkStdGen 123)

Does the strategy "rwhnf" do it for you?

Justin
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Control.Parallel.Strategies

2008-04-09 Thread Sebastian Sylvan
Hi,
I was toying with the Control.Parallel.Strategies library, but can't seem to
get it to actually do anything in parallel!

Here's the code:

import System.Random
import Control.Parallel.Strategies

fib :: Int -> Int
fib 0 = 1
fib 1 = 1
fib n = fib (n-1) + fib (n-2)

main = print $ parMap rnf fib $ take 80 $ randomRs (30,35) (mkStdGen 123)


I compile with "-threaded", and run with +RTS -N2 -RTS, but yet it stays at
50% on my dual core machine!

I should point out that any manual threading with forkIO does indeed use
100% of the CPU, and this problem happens on my work computer too (Vista on
my home computer, XP on the work one).

Anything I'm missing here?

Thanks,

-- 
Sebastian Sylvan
+44(0)7857-300802
UIN: 44640862
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe