-O option doesn't deal with par well
I tried to parallelize below code.
circleReg1 :: Frac -> Region
circleReg1 r (Pt x y) = x*x + y*y < r*r
I use -threaded option with dual-CPU machine. So I saw these code upgrade performance very much.
[circleReg2] r (Pt x y) =
let x' = (x*x)
y' = y*y
r' = r*r
in
x' `par` y' `par` r' `seq` x' + y' < r'
circleReg3 r (Pt x y) =
let x' = (x*x)
y' = y*y
r' = r*r
strategy = rnf x' `par` rnf y' `par` rnf r'
in
x' + y' < r' `demanding` strategy
But ... If I want to optimise my code by ghc using -O option, ghc notice error message like this;
circleReg2:
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ghc1572_0\ghc1572_0.hc: In function `scmg_entry':
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ghc1572_0\ghc1572_0.hc:1102: warning: implicit declaration of function `newSpark'
circleReg3:
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ghc980_0\ghc980_0.hc: In function `Main_lvl_entry':
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ghc980_0\ghc980_0.hc:1097: warning: implicit declaration of function `newSpark'
and -O option makes slower above code. It seems that performance goes back to before parallelize, or more slowly.
I saw this error on Windows. Power PC Mac with GHC 6.4.1 doesn't cause this problem ... but I don't test GHC 6.6 on Mac, so I don't know this bug cause only Windows or not.
Trac metadata
Trac field | Value |
---|---|
Version | 6.6 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | Unknown |
Architecture | Unknown |