[Haskell-cafe] Find out which part of code are causing parallelism?

ducis ducis_cn at 126.com
Fri Dec 28 08:19:09 UTC 2018

Hi all,

I am working on parallelising some program, however I just found out that without inserting any parallism manually
the program is already parallelised, presumably by some of the libraries referenced, as long as I enable -threaded
and +RTS -N8.

Unfortunately this parallism are actually slowing down my program, probably due to being of too fine granularity.
For example, with +RTS -N8 I have   
47.03user 38.06system 0:21.68elapsed 392%CPU
While with +RTS -N1 I have
16.57user 0.45system 0:17.02elapsed 100%CPU

In .prof file I can't find whether a function fired a spark or how much 'system' time a function used.
Nor can I find any names of functions/modules browsing through eventlog with ghc-events.
Is there a way to find out which functions/modules are causing any parallelism at all?

I am also trailing the post with the imports I used in case anyone immediately recognises parallelism by default in the package.
import Control.DeepSeq
import GHC.Generics (Generic, Generic1)
import Text.Parsec                                                                        
import Data.List                                                                          
import Data.Vector.Unboxed(fromList, (!))                                                 
import qualified Data.Vector as V                                                         
import qualified Data.Map as M                                                            
import qualified Data.Set as S                                                            
import Data.Char                                                                          
import Control.Applicative((*>),(<*))                                                     
import Test.QuickCheck.Monadic                                                            
import Test.QuickCheck                                                                    
import Control.Monad                                                                      
import Text.Regex                                                  
import Control.Applicative ((<$>), (<$), (<|>))       
import GHC.Read (readLitChar)                         
import Data.Char(isPrint)                             
import Text.ParserCombinators.ReadP                                            
import Text.Show.Pretty                                                                   
import Data.Functor                                                                       
import Data.Maybe                                                                         
import System.Environment(getArgs)
import Text.Read(readMaybe)                                                               
import Text.Printf                                                                               
import Data.Dynamic                                                                       
import Debug.Trace                                                                        
import Data.Ratio                                                                           
import qualified Data.DList as D                                                          
import Control.Monad.Trans.Writer.Strict                                                             
import Control.Monad.Trans.Class                                                          
import Data.Typeable(Typeable)                                                            
import qualified Data.HashMap.Lazy as H                                              


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20181228/eb7b7bc3/attachment.html>

More information about the Haskell-Cafe mailing list