[Haskell-cafe] Parallel compilation and execution?

michael rice nowgate at yahoo.com
Thu May 26 13:24:09 CEST 2011


How do I compile and run this parallel program?
Michael
===========================
import Control.Parallel
nfib :: Int -> Intnfib n | n <= 1 = 1       | otherwise = par n1 (seq n2 (n1 + n2 + 1))                     where n1 = nfib (n-1)                           n2 = nfib (n-2)
{-nfib :: Int -> Intnfib n | n <= 1 = 1       | otherwise = nfib (n-1) + nfib (n-2)-}

main = do putStrLn $ show $ nfib 39
===========================
[michael at hostname ~]$ ghc --make -threaded nfib.hs[michael at hostname ~]$ ./nfib +RTS -N3nfib: the flag -N3 requires the program to be built with -threadednfib: nfib: Usage: <prog> <args> [+RTS <rtsopts> | -RTS <args>] ... --RTS <args>nfib: nfib:    +RTS    Indicates run time system options follownfib:    -RTS    Indicates program arguments follownfib:   --RTS    Indicates that ALL subsequent arguments will be given to thenfib:            program (including any of these RTS flags)nfib: nfib: The following run time system options are available:nfib: nfib:   -?       Prints this message and exits; the program is not executednfib:   --info   Print information about the RTS used by this programnfib: nfib:   -K<size> Sets the maximum stack size (default 8M)  Egs: -K32k   -K512knfib:   -k<size> Sets the initial thread stack size (default 1k)  Egs: -k4k   -k2mnfib: nfib:   -A<size> Sets the minimum allocation area size (default
 512k) Egs: -A1m -A10knfib:   -M<size> Sets the maximum heap size (default unlimited)  Egs: -M256k -M1Gnfib:   -H<size> Sets the minimum heap size (default 0M)   Egs: -H24m  -H1Gnfib:   -m<n>    Minimum % of heap which must be available (default 3%)nfib:   -G<n>    Number of generations (default: 2)nfib:   -T<n>    Number of steps in younger generations (default: 2)nfib:   -c<n>    Use in-place compaction instead of copying in the oldest generationnfib:            when live data is at least <n>% of the maximum heap size set withnfib:            -M (default: 30%)nfib:   -c       Use in-place compaction for all oldest generation collectionsnfib:            (the default is to use copying)nfib:   -w       Use mark-region for the oldest generation (experimental)nfib: nfib:   -t[<file>] One-line GC statistics (if <file> omitted, uses stderr)nfib:   -s[<file>] Summary  GC statistics (if <file> omitted, uses
 stderr)nfib:   -S[<file>] Detailed GC statistics (if <file> omitted, uses stderr)nfib: nfib: nfib:   -Z       Don't squeeze out update frames on stack overflownfib:   -B       Sound the bell at the start of each garbage collectionnfib: nfib:   -hT      Heap residency profile (output file <program>.hp)nfib:   -i<sec>  Time between heap samples (seconds, default: 0.1)nfib: nfib:   -C<secs>  Context-switch interval in seconds.nfib:             0 or no argument means switch as often as possible.nfib:             Default: 0.02 sec; resolution is set by -V below.nfib:   -V<secs>  Master tick interval in seconds (0 == disable timer).nfib:             This sets the resolution for -C and the profile timer -i.nfib:             Default: 0.02 sec.nfib: nfib:   --install-signal-handlers=<yes|no>nfib:             Install signal handlers (default: yes)nfib: nfib: RTS options may also be specified using the GHCRTS
 environment variable.nfib: nfib: Other RTS options may be available for programs compiled a different way.nfib: The GHC User's Guide has full details.nfib: [michael at hostname ~]$ 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110526/8a911182/attachment.htm>


More information about the Haskell-Cafe mailing list