[clean-list] Parallel machines (Am I missing something)?

John van Groningen johnvg at cs.ru.nl
Tue Oct 27 17:25:34 MET 2009


Philippos Apolinarius wrote:
>I am playing with Haskell and Clean in a machines with four processors.  I started with a program that does something stupid that takes time. Let us assum that the program is in file para.hs. I compile it thus:
>
>ghc pfib.hs -threaded --make
>
>I can run it in 2 of my four cores. Here is how I did it:
>
>pfib.exe +RTS -N2
>
>I used something to monitor core activity, and discovered that two of the cores were working like crazy.  The two core changed from execution to execution. The rule seems to be the following:
>
>First run: Core 1 and core 2
>Second run: Core 2 and core 3
>Third run: Core 3 and core 4
>Forth run: Core 4 and core 1
>
>And so on. As soon as execution stops, activity drops to zero in the busy cores.  Now, let us increase the number of cores to 4:
>
>pfib +RTS -N4
>
>Now, I see activity in all four cores. So, Haskell seem to be working as anounced. Problem is... if I create 2 or 4 processes in Clean (using ObjectIO), I get exactly the same pattern, i.e.,  Clean programs are distributed between the cores. If I use 2 processes, they are distributed between 2 cores, if I use 4 processes, the problem activates four cores, etc.  Is Clean parallel too, or I am missing something?

No, currently all ObjectIO's processes use the same thread. The scheduler of
the operating system is probably not using the same core every time the thread
is scheduled for execution.

>..

Kind regards,

John van Groningen


More information about the clean-list mailing list