Question about GUM
Changming Ma
mac@cs.ttu.edu
Thu, 20 Jun 2002 21:58:35 -0500 (CDT)
Hi there,
I'm getting confused of the run-time system behavior of GUM. When I ran a quicksort
program in GUM with profiling flag, I got different "task" distributions in the PS
file generated everytime, e.g., the peak of task number may be 19 at the first time
and 48 at the second. While it's quite reasonable that the clock cycles vary
dramatically, it's somewhat strange to me that the task distributions are so
different. Any hints? I do appreaciate it.
BTW, seems the program does not stop if the input list has more than 350 elements,
althought it works fine otherwise. Will it get better if I use an SMP system?
Thanks in advance.
PS: I'm using GUM-4.06, PVM3, RH LINUX6.2 on a single processor system.
Program and RTS flags
quicksort +RTS -qP -sstderr
grs2gr *quicksort.???.gr > quicksort.gr
gr2ps -o quicksort.ps quicksort.gr
--source code
module Main(main) where
import System(getArgs)
import Parallel
forceList :: [a] -> ()
forceList [] = ()
forceList (x:xs) = x `seq` forceList xs
quicksortF::[Int]->[Int]
quicksortF [] = []
quicksortF [x] = [x]
quicksortF (x:xs) =
(forceList losort) `par`
(forceList hisort) `par`
losort ++ (x:hisort)
where
losort = quicksortF [y|y <- xs, y < x]
hisort = quicksortF [y|y <- xs, y >= x]
args_to_IntList :: [String] -> [Int]
args_to_IntList a = if length a < 1
then error "Parallel Quick Sort: no enough args \n"
else map read a
main = putStr ("get " ++ (show (quicksortF l))++"\n")
l = [ 658986,123141,737929,681645,329651,
...
925104]