
Hi folks, I'm working on a project for which the solution is highly parallelizable. I've been writing it so far for GHC as a single-threaded app. I'd like to be able to split the job into multiple pieces, and spawn different system threads for each piece, so they will run on separate CPUs. Either each thread needs to write to the same IO handle, or else the results need to be collected when the threads are merged, so the results can all be printed. I'm working on Linux. What's the easiest way to accomplish this? Glasgow Parallel Haskell? Is there a Posix.Threads library? I understand that Haskell threads (Control.Concurrent) all run in one system thread, so would not take advantage of SMP. I suppose in the worst case I can write a shell program that divides up the problem, runs several worker processes to output intermediate results to files, then combines the results to the desired filehandle. Thanks, Lyle

Hello Lyle, Wednesday, September 20, 2006, 6:45:47 AM, you wrote:
separate CPUs. Either each thread needs to write to the same IO handle,
it's ok in GHC
I'm working on Linux. What's the easiest way to accomplish this? Glasgow Parallel Haskell? Is there a Posix.Threads library? I understand that Haskell threads (Control.Concurrent) all run in one system thread, so would not take advantage of SMP.
ghc 6.6 uses SMP even for Haskell threads: http://www.haskell.org/ghc/dist/current/docs/users_guide/release-6-6.html it's going to be released in a few days, you can also download current RC versions -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

On Tue, 2006-09-19 at 19:45 -0700, Lyle Kopnicky wrote:
Hi folks,
I'm working on a project for which the solution is highly parallelizable. I've been writing it so far for GHC as a single-threaded app. I'd like to be able to split the job into multiple pieces, and spawn different system threads for each piece, so they will run on separate CPUs. Either each thread needs to write to the same IO handle, or else the results need to be collected when the threads are merged, so the results can all be printed.
I'm working on Linux. What's the easiest way to accomplish this? Glasgow Parallel Haskell? Is there a Posix.Threads library? I understand that Haskell threads (Control.Concurrent) all run in one system thread, so would not take advantage of SMP.
In GHC 6.6 they can run on more than one system thread so take advantage of SMP. GHC 6.6 will be out soon but you can start now by trying a recent day's 6.5 snapshot. See the GHC website's download section. Duncan

| I'm working on a project for which the solution is highly | parallelizable. I've been writing it so far for GHC as a single-threaded | app. I'd like to be able to split the job into multiple pieces, and | spawn different system threads for each piece, so they will run on | separate CPUs. Either each thread needs to write to the same IO handle, | or else the results need to be collected when the threads are merged, so | the results can all be printed. GHC 6.6 (release candidate available) supports parallel execution on SMP machines. http://www.haskell.org/ghc/dist/current/docs/users_guide/sec-using-smp.h tml Garbage collection is not parallelised yet, something we plan to fix this autumn. If you want a distributed memory machine (e.g. cluster of boxes) then you may want GPH, http://www.macs.hw.ac.uk/~dsg/gph/ although it's based on an older version of GHC. Simon | -----Original Message----- | From: haskell-cafe-bounces@haskell.org [mailto:haskell-cafe-bounces@haskell.org] On Behalf Of Lyle | Kopnicky | Sent: 20 September 2006 03:46 | To: haskell-cafe@haskell.org | Subject: [Haskell-cafe] System threads? | | Hi folks, | | I'm working on a project for which the solution is highly | parallelizable. I've been writing it so far for GHC as a single-threaded | app. I'd like to be able to split the job into multiple pieces, and | spawn different system threads for each piece, so they will run on | separate CPUs. Either each thread needs to write to the same IO handle, | or else the results need to be collected when the threads are merged, so | the results can all be printed. | | I'm working on Linux. What's the easiest way to accomplish this? Glasgow | Parallel Haskell? Is there a Posix.Threads library? I understand that | Haskell threads (Control.Concurrent) all run in one system thread, so | would not take advantage of SMP. | | I suppose in the worst case I can write a shell program that divides up | the problem, runs several worker processes to output intermediate | results to files, then combines the results to the desired filehandle. | | Thanks, | Lyle | _______________________________________________ | Haskell-Cafe mailing list | Haskell-Cafe@haskell.org | http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (4)
-
Bulat Ziganshin
-
Duncan Coutts
-
Lyle Kopnicky
-
Simon Peyton-Jones