Don Stewart wrote:
andrewcoppin:
Somebody correct me here - I was under the impression that you only ever
need forkIO if you're doing something strange with FFI, and usually you
just want fork?
That's incorrect. forkIO is *the* basic threading primitive for fast,
light Haskell threa
Am Dienstag, 6. November 2007 schrieb Andrew Coppin:
>
> Somebody correct me here - I was under the impression that you only ever
> need forkIO if you're doing something strange with FFI, and usually you
> just want fork?
You're probably thinking of forkOS vs. forkIO.
AFAIK there is no fork in Has
andrewcoppin:
> Tim Docker wrote:
> >Is it possible to use the forkIO primitive to cause pure computations
> >to be evaluated in parallel threads?
> >
>
> Somebody correct me here - I was under the impression that you only ever
> need forkIO if you're doing something strange with FFI, and usual
Tim Docker wrote:
Is it possible to use the forkIO primitive to cause pure computations
to be evaluated in parallel threads?
Somebody correct me here - I was under the impression that you only ever
need forkIO if you're doing something strange with FFI, and usually you
just want fork?
__
On Nov 5, 2007, at 15:46 , Andrew Coppin wrote:
You can spark a thread for each computation of fn, like such:
writeArray framebuffer p `parApp` fn p
where
parApp f x = x `par` f x
Hmm, that may be a little *too* fine-grained. (But then, just
because I spark 175,862 threads doesn't mean
Hello Bulat,
Tuesday, November 6, 2007, 3:43:30 AM, you wrote:
> yes, that's true. but we can force evaluation of array elements:
> task (i,j) = do putArray arr (i,j) (i*j)
> return $! getArray arr (i,j)
correct way:
task (i,j) = do putArray arr (i,j) $! (i*j)
this forces eva
Hello Tim,
Tuesday, November 6, 2007, 3:13:05 AM, you wrote:
> Is it possible to use the forkIO primitive to cause pure computations
> to be evaluated in parallel threads?
> It seems to me that laziness would always prevent any evaluation until
> the result was used in a consuming thread (and he
L PROTECTED]
Sent: Tuesday, 6 November 2007 11:16 AM
To: Tim Docker
Cc: haskell-cafe@haskell.org; Bulat Ziganshin
Subject: Re: [Haskell-cafe] Go parallel
timd:
> Is it possible to use the forkIO primitive to cause pure computations
> to be evaluated in parallel threads?
>
> It seems to
timd:
> Is it possible to use the forkIO primitive to cause pure computations
> to be evaluated in parallel threads?
>
> It seems to me that laziness would always prevent any evaluation until
> the result was used in a consuming thread (and hence would occur
> serially, in that thread).
Try `par`
-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Bulat Ziganshin
Sent: Tuesday, 6 November 2007 10:59 AM
To: Andrew Coppin
Cc: haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] Go parallel
Hello Andrew,
Monday, November 5, 2007, 11:12:33 PM, you wrote:
> How do I alter t
Hello Andrew,
Monday, November 5, 2007, 11:12:33 PM, you wrote:
> How do I alter this to compute fn in multiple threads in parallel? (As
jobs :: [IO()]
let fork job = do mvar <- newEmptyMVar
forkIO$ do job; putMVar mvar ()
return mvar
tasks <- mapM fork jobs
m
Jonathan Cast wrote:
On Mon, 2007-11-05 at 20:12 +, Andrew Coppin wrote:
Hi folks.
Take a look at this:
render :: IOArray Point Colour -> (Point -> Colour) -> IO ()
render framebuffer fn = mapM_ (\p -> writeArray framebuffer p (fn p))
all_points
How do I alter this to compute fn
On Mon, 2007-11-05 at 20:12 +, Andrew Coppin wrote:
> Hi folks.
>
> Take a look at this:
>
> render :: IOArray Point Colour -> (Point -> Colour) -> IO ()
> render framebuffer fn = mapM_ (\p -> writeArray framebuffer p (fn p))
> all_points
>
> How do I alter this to compute fn in multip
Hi folks.
Take a look at this:
render :: IOArray Point Colour -> (Point -> Colour) -> IO ()
render framebuffer fn = mapM_ (\p -> writeArray framebuffer p (fn p))
all_points
How do I alter this to compute fn in multiple threads in parallel? (As
you can see from the type signature, the calcu
14 matches
Mail list logo