Hi,
I've been trying to compile a toy example with GHC's parallel option.
The `impossible' happened ...
How do I get the parallel machinery working?
Best,
Dirk
Here is the verbose compiler report:
(the program code follows after that)
droog:~/Hacks/haskell/Equations/src/test> ghc -parallel
-i/softa/zeus/prg/fptools/lib/sparc-sun-solaris2/ghc-4.04/imports/concurrent:/softa/zeus/prg/fptools/lib/sparc-sun-solaris2/ghc-4.04/imports/std
-v parFact.hs
The Glorious Glasgow Haskell Compilation System, version 4.04, patchlevel 1
Effective command line: -parallel
-i/softa/zeus/prg/fptools/lib/sparc-sun-solaris2/ghc-4.04/imports/concurrent:/softa/zeus/prg/fptools/lib/sparc-sun-solaris2/ghc-4.04/imports/std
-v
ghc: unrecognised option: -fstack-check
Ineffective C pre-processor:
echo '{-# LINE 1 "parFact.hs" -}' > /tmp/ghc21755.cpp && cat parFact.hs >>
/tmp/ghc21755.cpp
real 0.0
user 0.0
sys 0.0
ghc:compile:Output file parFact.o doesn't exist
ghc:compile:Interface file parFact.hi doesn't exist
ghc:recompile:Input file parFact.hs newer than parFact.o
Haskell compiler:
/softa/zeus/prg/fptools/lib/sparc-sun-solaris2/ghc-4.04/hsc /tmp/ghc21755.cpp
-fparallel -fignore-interface-pragmas -fomit-interface-pragmas -fsimplify [
-finline-phase2 -fmax-simplifier-iterations4 ] -fwarn-overlapping-patterns
-fwarn-missing-methods -fwarn-duplicate-exports -fhi-version=404 -static
-himap=/softa/zeus/prg/fptools/lib/sparc-sun-solaris2/ghc-4.04/imports/concurrent%.hi:/softa/zeus/prg/fptools/lib/sparc-sun-solaris2/ghc-4.04/imports/std%.hi:.%.hi:/softa/zeus/prg/fptools/lib/sparc-sun-solaris2/ghc-4.04/imports/concurrent%.mp_hi:/softa/zeus/prg/fptools/lib/sparc-sun-solaris2/ghc-4.04/imports/concurrent%.mp_hi:/softa/zeus/prg/fptools/lib/sparc-sun-solaris2/ghc-4.04/imports/std%.mp_hi
-v -hifile=/tmp/ghc21755.hi -C=/tmp/ghc21755.hc -F=/tmp/ghc21755_stb.c
-FH=/tmp/ghc21755_stb.h +RTS -H6000000 -K1000000
Glasgow Haskell Compiler, version 4.04, for Haskell 98, compiled by GHC version 4.04
panic! (the `impossible' happened):
closureCodeBody:arg_regs
Please report it as a compiler bug to [EMAIL PROTECTED]
real 2.5
user 2.3
sys 0.1
deleting... /tmp/ghc21755.cpp /tmp/ghc21755.hi /tmp/ghc21755.hc /tmp/ghc21755_stb.c
/tmp/ghc21755_stb.h
rm -f /tmp/ghc21755*
parFact.hs:
module Main(main) where
import IO
import Parallel
pfc :: Int -> Int -> Int -> Int
pfc x y c
| y - x > c = f1 `par` (f2 `seq` (f1+f2))
| x == y = x
| otherwise = pf x m + pf (m+1) y
where
m = (x+y) `div` 2
f1 = pfc x m c
f2 = pfc (m+1) y c
pf :: Int -> Int -> Int
pf x y
| x < y = pf x m + pf (m+1) y
| otherwise = x
where
m = (x+y) `div` 2
parfact x c = pfc 1 x c
mk_num :: String -> Int
mk_num s = (fst . head) (reads s :: [(Int,String)])
main = do putStr "argument 1: "
arg1 <- getLine
putStr "argument 2: "
arg2 <- getLine
putStrLn (show (parfact (mk_num arg1) (mk_num arg2)))