
#10414: Buggy behavior with threaded runtime (-N1 working, -N2 getting into <<loop>>) -------------------------------------+------------------------------------- Reporter: exio4 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by michaelt): I simplified the problem a little. The first command line argument is for the chunk size given to `parListChunk`: {{{#!hs import Control.Parallel.Strategies import System.Environment type Pair = (Int, [Int]) loop' :: Pair -> [Pair] loop' (size,qns) = go 1 where go n | n > size = [] | otherwise = (size, n:qns) : (go (n+1)) worker :: Int -> Int -> Pair -> [Pair] worker chunksize = go where go 1 = loop' go n = withStrategy (parListChunk chunksize rseq) . concatMap (go (n-1)) . loop' main :: IO () main = do chunksize:n:_ <- fmap (map read) getArgs print $ length (worker chunksize n (n,[])) }}} With this i get, e.g.: {{{ $ ghc -O2 -threaded -rtsopts -fforce-recomp threads.hs $ time ./threads 8 7 +RTS -N1 823543 real 0m2.133s user 0m2.025s sys 0m0.097s $ time ./threads 8 7 +RTS -N2 threads: <<loop>> real 0m0.368s user 0m0.074s sys 0m0.016s }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10414#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler