is there any benefit running happstack apps with +RTS -NK

9 views
Skip to first unread message

Thomas Hartman

unread,
Dec 19, 2009, 10:28:19 PM12/19/09
to HA...@googlegroups.com
I was just reading "A Tutorial on Parallel and Concurrent Programming
in Haskell" by SP Jones and Satnam Singh.

Currently I compile happstack apps with -threaded in the .cabal file,
but I don't run with +RTS -N4 (I have four processors on my linode).

Am I doing it wrong?

--
Need somewhere to put your code? http://patch-tag.com
Want to build a webapp? http://happstack.com

Gwern Branwen

unread,
Dec 19, 2009, 10:33:10 PM12/19/09
to ha...@googlegroups.com
On Sat, Dec 19, 2009 at 10:28 PM, Thomas Hartman
<thomash...@googlemail.com> wrote:
> I was just reading "A Tutorial on Parallel and Concurrent Programming
> in Haskell" by SP Jones and Satnam Singh.
>
> Currently I compile happstack apps with -threaded in the .cabal file,
> but I don't run with +RTS -N4 (I have four processors on my linode).
>
> Am I doing it wrong?

Unless I'm missing something, yes, you are. -threaded only makes it
*possible* to use multiple processors, as I've understood it, +RTS -N4
-RTS actually makes a particular invocation use multiple processors.
At least, this is how I've always understood it.

(I remember reading that it is possible for a program to fiddle with
its own RTS options so that in theory one could specify -threaded in
the .cabal and then the fiddling could auto -N4, or use the
system-information module to find out how many processors are
available and set -Nn, but this was difficult and ill-advised for some
reason.)

--
gwern

Don Stewart

unread,
Dec 19, 2009, 10:36:42 PM12/19/09
to ha...@googlegroups.com
thomashartman1:

> I was just reading "A Tutorial on Parallel and Concurrent Programming
> in Haskell" by SP Jones and Satnam Singh.
>
> Currently I compile happstack apps with -threaded in the .cabal file,
> but I don't run with +RTS -N4 (I have four processors on my linode).
>
> Am I doing it wrong?
>

You compile with -threaded to get the multithreaded runtime, and if you
want to use more than one core to run those forkIO'd threads, then
you'll need +RTS -N4 or more, otherwise it will pin them to one core.

-- Don

Reply all
Reply to author
Forward
0 new messages