Should heapCensus work with threaded programs?
Ben Lippmeier
benl at ouroborus.net
Tue Dec 7 08:16:00 CET 2010
Hi Simon,
Threaded programs are crashing for me with heap profiling turned on. I've only seen them crash with an interval < 0.1s. They seem fine with -N1. I have multiple crashing programs like so:
> limitingfactor:dph-quickhull-vector benl$ pwd
> /Users/benl/devel/ghc/build/baseline/ghc-head/libraries/dph/dph-examples/dist/build/dph-quickhull-vector
>
> limitingfactor:dph-quickhull-vector benl$ ./dph-quickhull-vector io 1000000 +RTS -hT -N4 -i0.01
> Segmentation fault
>
> limitingfactor:dph-quickhull-vector benl$ ./dph-quickhull-vector io 1000000 +RTS -hT -N4 -i0.01
> elapsedTimeMS = 65
> cpuTimeMS = 151
>
> limitingfactor:dph-quickhull-vector benl$ ./dph-quickhull-vector io 1000000 +RTS -hT -N4 -i0.01
> dph-quickhull-vector: internal error: heapCensus, unknown object: 32698
> (GHC version 7.1.20101207 for i386_apple_darwin)
> Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
> Abort trap
>
> limitingfactor:dph-quickhull-vector benl$ ./dph-quickhull-vector io 1000000 +RTS -hT -N4 -i0.01
> elapsedTimeMS = 59
> cpuTimeMS = 149
>
> limitingfactor:dph-quickhull-vector benl$ ./dph-quickhull-vector io 1000000 +RTS -hT -N4 -i0.01
> elapsedTimeMS = 72
> cpuTimeMS = 230
>
> limitingfactor:dph-quickhull-vector benl$ ./dph-quickhull-vector io 1000000 +RTS -hT -N4 -i0.01
> dph-quickhull-vector: internal error: heapCensus, unknown object: 58
> (GHC version 7.1.20101207 for i386_apple_darwin)
> Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
> Abort trap
This is with the code in [1]. Granted this version uses unsafe Data.Vector ops, but I'm not convinced that's the actual problem. There is a sequential version here [2] that uses all safe Data.Vector ops, and still crashes about one time in 50. The (parallel) vectorised version [3] crashes every time.
Compiling the vectorised version with debugging turned on triggers an assertion in sm/Storage.c:
> desire:dph-examples benl$ pwd
> /Users/benl/devel/ghc/ghc-head-devel/libraries/dph/dph-examples
>
> desire:dph-examples benl$ ~/devel/ghc/ghc-head-devel/inplace/bin/ghc-stage2 -dcore-lint -Odph -debug -rtsopts -threaded --make spectral/QuickHull/dph/Main.hs -package dph-par -package dph-prim-par -ilib -ispectral/QuickHull/lib -ispectral/QuickHull/dph/ -o quickhull -fforce-recomp
> [1 of 7] Compiling Randomish ( lib/Randomish.hs, lib/Randomish.o )
> [2 of 7] Compiling Points2D.Types ( lib/Points2D/Types.hs, lib/Points2D/Types.o )
> [3 of 7] Compiling Points2D.Generate ( lib/Points2D/Generate.hs, lib/Points2D/Generate.o )
> [4 of 7] Compiling Timing ( lib/Timing.hs, lib/Timing.o )
> [5 of 7] Compiling SVG ( spectral/QuickHull/lib/SVG.hs, spectral/QuickHull/lib/SVG.o )
> [6 of 7] Compiling QuickHullVect ( spectral/QuickHull/dph/QuickHullVect.hs, spectral/QuickHull/dph/QuickHullVect.o )
> [7 of 7] Compiling Main ( spectral/QuickHull/dph/Main.hs, spectral/QuickHull/dph/Main.o )
> Linking quickhull ...
>
> desire:dph-examples benl$ ./quickhull 1000000 +RTS -N4 -hT -i0.01 -DS
> quickhull: internal error: ASSERTION FAILED: file rts/sm/Storage.c, line 640
>
> (GHC version 7.1.20101203 for i386_apple_darwin)
> Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
> Abort trap
>
Is this supposed to work? If it's not a bug in the RTS it might be something in Data.Vector...
Cheers,
Ben.
[1] http://darcs.haskell.org/libraries/dph/dph-examples/spectral/QuickHull/vector/QuickHullIO.hs
[2] http://darcs.haskell.org/libraries/dph/dph-examples/spectral/QuickHull/vector/QuickHullSplit.hs
[3] http://darcs.haskell.org/libraries/dph/dph-examples/spectral/QuickHull/dph/QuickHullVect.hs
More information about the Cvs-ghc
mailing list