[commit: ghc] ghc-lwc2: Automatically changing the number of available processors. (9a077b3)

Sivaramakrishnan Krishnamoorthy Chandrasekaran t-sichan at microsoft.com
Fri Mar 1 06:58:41 CET 2013


Repository : http://darcs.haskell.org/ghc.git/

On branch  : ghc-lwc2

http://hackage.haskell.org/trac/ghc/changeset/9a077b3d17a42de063c334cb3486c4f405b4c39b

>---------------------------------------------------------------

commit 9a077b3d17a42de063c334cb3486c4f405b4c39b
Author: KC Sivaramakrishnan <chandras at cs.purdue.edu>
Date:   Fri Mar 1 00:56:30 2013 -0500

    Automatically changing the number of available processors.

>---------------------------------------------------------------

 tests/Benchmarks/Mandelbrot/mandelbrot-lwc.hs     | 3 ++-
 tests/Benchmarks/Mandelbrot/mandelbrot-vanilla.hs | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/Benchmarks/Mandelbrot/mandelbrot-lwc.hs b/tests/Benchmarks/Mandelbrot/mandelbrot-lwc.hs
index af2cbae..4518940 100644
--- a/tests/Benchmarks/Mandelbrot/mandelbrot-lwc.hs
+++ b/tests/Benchmarks/Mandelbrot/mandelbrot-lwc.hs
@@ -30,7 +30,8 @@ main = do
     q <- newEmptyMVar
     replies <- replicateM w newEmptyMVar
     atomically $ mapM_ (asyncPutMVar q) $ zip coords replies
-    replicateM_ 48 . forkIO $ worker q w m n
+    numProcs <- getNumCapabilities
+    replicateM_ numProcs . forkIO $ worker q w m n
     yield
 
     putStrLn ("P4\n"++show w++" "++show w)
diff --git a/tests/Benchmarks/Mandelbrot/mandelbrot-vanilla.hs b/tests/Benchmarks/Mandelbrot/mandelbrot-vanilla.hs
index ec93fad..46835df 100644
--- a/tests/Benchmarks/Mandelbrot/mandelbrot-vanilla.hs
+++ b/tests/Benchmarks/Mandelbrot/mandelbrot-vanilla.hs
@@ -18,7 +18,8 @@ main = do
     q <- newChan
     replies <- replicateM w newEmptyMVar
     mapM_ (writeChan q) $ zip coords replies
-    replicateM_ 48 . forkIO $ worker q w m n
+    numProcs <- getNumCapabilities
+    replicateM_ numProcs . forkIO $ worker q w m n
 
     putStrLn ("P4\n"++show w++" "++show w)
     mapM_ (takeMVar >=> \b -> hPutBuf stdout b n) replies





More information about the ghc-commits mailing list