Re: [Haskell-cafe] Compiling ghc for using STM

2006-07-17 Thread Bulat Ziganshin
Hello Asfand,

Monday, July 17, 2006, 7:31:23 PM, you wrote:

 I finally got my spiffy dual-core processor (an Opteron 165 no-less)
 and want to learn STM, since I think it and haskell are the future of
 concurrent programming.

 How do I compile Haskell to be able learn STM on it, using proper
 threading?  I know there's a parallel haskell flag, but I read
 somewhere about it running on top of some special server that lets it
 work in parallel threads or something.

you should compile with -threaded flag which allows to preempt
threads created in your program with forkIO/forkOS

if you want to really use 2 processors, you should use ghc 6.5, which
is still in beta stage. ghc 6.4 executes all the Haskell code on one
processor (to be exact, at each moment there is only one program
thread executing Haskell code)

look at 
http://www.cse.unsw.edu.au/~chak/haskell/ghc/comm/rts-libs/multi-thread.html
which describes 6.4 situation

http://research.microsoft.com/Users/simonpj/papers/marktoberdorf/marktoberdorf.ps.gz
contains Concurrency chapter what says more about concurrency in GHC

You can find more information about concurrency and STM at the
http://haskell.org/haskellwiki/GHC/Concurrency page


ps: are you one of Iranian hackers cheating A-bomb? ;)

-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]

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


Re: [Haskell-cafe] Compiling ghc for using STM

2006-07-17 Thread Duncan Coutts
On Mon, 2006-07-17 at 18:29 +0100, Asfand Yar Qazi wrote:
 On 7/17/06, Bulat Ziganshin [EMAIL PROTECTED] wrote:
 
  if you want to really use 2 processors, you should use ghc 6.5, which
  is still in beta stage. ghc 6.4 executes all the Haskell code on one
  processor (to be exact, at each moment there is only one program
  thread executing Haskell code)
 
 I should have explained: I've already got ghc trunk successfully
 compiled.  I just need to turn on native threading or whatever its
 called so I can learn STM'ism (and no, I can't make do with in-process
 threads - I didn't pay 230 GBP for a dual-core processor to have one
 in the background processing cron jobs :-)
 
 So, as soon as I figure out how to compile ghc 6.5 beta, and how to
 include parallelisation support, I'm set :-)

I believe that the smp flavour of the RTS is now built by default and so
all you need to do is use it when linking a program:

ghc-6.5 -smp Foo.hs -o foo

Then when running the program you can tell the RTS how many OS threads
to use:

./foo +RTS -N2 -RTS


Duncan

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