ThreadScope Tour/Run
< ThreadScope Tour
Jump to navigation
Jump to search
Revision as of 17:36, 7 December 2011 by DuncanCoutts (talk | contribs) (→Steps: add -l RTS flag to generate trace)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Objective
Run ThreadScope on a sample program and get a trace.
Steps
Copy the following parallel code to hellofib.hs
import Control.Parallel.Strategies import System.Environment fib 0 = 1 fib 1 = 1 fib n = runEval $ do x <- rpar (fib (n-1)) y <- rseq (fib (n-2)) return (x + y + 1) main = do args <- getArgs n <- case args of [] -> return 20 [x] -> return (read x) _ -> fail ("Usage: hellofib [n]") print (fib n)
Build hellofib.hs
ghc -O2 -rtsopts -eventlog -threaded hellofib
Run hellofib
./hellofib +RTS -N2 -l
View its trace
threadscope hellofib.eventlog # on Windows, may be hellofib.exe.eventlog