<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><div><font class="Apple-style-span" face="arial" size="2">How do I compile and run this parallel program?</font></div><div><font class="Apple-style-span" face="arial" size="2"><br></font></div><div><font class="Apple-style-span" face="arial" size="2">Michael</font></div><div><font class="Apple-style-span" face="arial" size="2"><br></font></div><div><font class="Apple-style-span" face="arial" size="2">===========================</font></div><div><font class="Apple-style-span" face="arial" size="2"><br></font></div><div><font class="Apple-style-span" face="arial" size="2">import Control.Parallel</font></div><div><font class="Apple-style-span" face="arial" size="2"><br></font></div><div><font class="Apple-style-span" face="arial" size="2">nfib :: Int -&gt; Int</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib n | n &lt;= 1 =
 1</font></div><div><font class="Apple-style-span" face="arial" size="2">&nbsp; &nbsp; &nbsp; &nbsp;| otherwise = par n1 (seq n2 (n1 + n2 + 1))</font></div><div><font class="Apple-style-span" face="arial" size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;where n1 = nfib (n-1)</font></div><div><font class="Apple-style-span" face="arial" size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;n2 = nfib (n-2)</font></div><div><font class="Apple-style-span" face="arial" size="2"><br></font></div><div><font class="Apple-style-span" face="arial" size="2">{-</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib :: Int -&gt; Int</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib n | n &lt;= 1 = 1</font></div><div><font class="Apple-style-span" face="arial" size="2">&nbsp; &nbsp; &nbsp; &nbsp;| otherwise = nfib (n-1) + nfib
 (n-2)</font></div><div><font class="Apple-style-span" face="arial" size="2">-}</font></div><div><font class="Apple-style-span" face="arial" size="2"><br></font></div><div><font class="Apple-style-span" face="arial" size="2"><br></font></div><div><font class="Apple-style-span" face="arial" size="2">main = do putStrLn $ show $ nfib 39</font></div><div><font class="Apple-style-span" face="arial" size="2"><br></font></div><div><font class="Apple-style-span" face="arial" size="2">===========================</font></div><div><font class="Apple-style-span" face="arial" size="2"><br></font></div><div><font class="Apple-style-span" face="arial" size="2">[michael@hostname ~]$ ghc --make -threaded nfib.hs</font></div><div><font class="Apple-style-span" face="arial" size="2">[michael@hostname ~]$ ./nfib +RTS -N3</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: the flag -N3 requires the program to be built with
 -threaded</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib:&nbsp;</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: Usage: &lt;prog&gt; &lt;args&gt; [+RTS &lt;rtsopts&gt; | -RTS &lt;args&gt;] ... --RTS &lt;args&gt;</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib:&nbsp;</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: &nbsp; &nbsp;+RTS &nbsp; &nbsp;Indicates run time system options follow</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: &nbsp; &nbsp;-RTS &nbsp; &nbsp;Indicates program arguments follow</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: &nbsp; --RTS &nbsp; &nbsp;Indicates that ALL subsequent arguments will be given to the</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;program (including any of these RTS
 flags)</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib:&nbsp;</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: The following run time system options are available:</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib:&nbsp;</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: &nbsp; -? &nbsp; &nbsp; &nbsp; Prints this message and exits; the program is not executed</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: &nbsp; --info &nbsp; Print information about the RTS used by this program</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib:&nbsp;</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: &nbsp; -K&lt;size&gt; Sets the maximum stack size (default 8M) &nbsp;Egs: -K32k &nbsp; -K512k</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: &nbsp; -k&lt;size&gt;
 Sets the initial thread stack size (default 1k) &nbsp;Egs: -k4k &nbsp; -k2m</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib:&nbsp;</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: &nbsp; -A&lt;size&gt; Sets the minimum allocation area size (default 512k) Egs: -A1m -A10k</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: &nbsp; -M&lt;size&gt; Sets the maximum heap size (default unlimited) &nbsp;Egs: -M256k -M1G</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: &nbsp; -H&lt;size&gt; Sets the minimum heap size (default 0M) &nbsp; Egs: -H24m &nbsp;-H1G</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: &nbsp; -m&lt;n&gt; &nbsp; &nbsp;Minimum % of heap which must be available (default 3%)</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: &nbsp; -G&lt;n&gt; &nbsp; &nbsp;Number of generations (default:
 2)</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: &nbsp; -T&lt;n&gt; &nbsp; &nbsp;Number of steps in younger generations (default: 2)</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: &nbsp; -c&lt;n&gt; &nbsp; &nbsp;Use in-place compaction instead of copying in the oldest generation</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;when live data is at least &lt;n&gt;% of the maximum heap size set with</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-M (default: 30%)</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: &nbsp; -c &nbsp; &nbsp; &nbsp; Use in-place compaction for all oldest generation collections</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(the default is to
 use copying)</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: &nbsp; -w &nbsp; &nbsp; &nbsp; Use mark-region for the oldest generation (experimental)</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib:&nbsp;</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: &nbsp; -t[&lt;file&gt;] One-line GC statistics (if &lt;file&gt; omitted, uses stderr)</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: &nbsp; -s[&lt;file&gt;] Summary &nbsp;GC statistics (if &lt;file&gt; omitted, uses stderr)</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: &nbsp; -S[&lt;file&gt;] Detailed GC statistics (if &lt;file&gt; omitted, uses stderr)</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib:&nbsp;</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib:&nbsp;</font></div><div><font class="Apple-style-span"
 face="arial" size="2">nfib: &nbsp; -Z &nbsp; &nbsp; &nbsp; Don't squeeze out update frames on stack overflow</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: &nbsp; -B &nbsp; &nbsp; &nbsp; Sound the bell at the start of each garbage collection</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib:&nbsp;</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: &nbsp; -hT &nbsp; &nbsp; &nbsp;Heap residency profile (output file &lt;program&gt;.hp)</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: &nbsp; -i&lt;sec&gt; &nbsp;Time between heap samples (seconds, default: 0.1)</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib:&nbsp;</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: &nbsp; -C&lt;secs&gt; &nbsp;Context-switch interval in seconds.</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib:
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0 or no argument means switch as often as possible.</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Default: 0.02 sec; resolution is set by -V below.</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: &nbsp; -V&lt;secs&gt; &nbsp;Master tick interval in seconds (0 == disable timer).</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This sets the resolution for -C and the profile timer -i.</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Default: 0.02 sec.</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib:&nbsp;</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: &nbsp; --install-signal-handlers=&lt;yes|no&gt;</font></div><div><font
 class="Apple-style-span" face="arial" size="2">nfib: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Install signal handlers (default: yes)</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib:&nbsp;</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: RTS options may also be specified using the GHCRTS environment variable.</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib:&nbsp;</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: Other RTS options may be available for programs compiled a different way.</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib: The GHC User's Guide has full details.</font></div><div><font class="Apple-style-span" face="arial" size="2">nfib:&nbsp;</font></div><div><font class="Apple-style-span" face="arial" size="2">[michael@hostname ~]$&nbsp;</font></div><div style="font-family: arial; font-size: 10pt;
 "><br></div></td></tr></table>