[GHC] #8231: Haskell's Run Time System doesn't save electricity
GHC
ghc-devs at haskell.org
Thu Sep 5 07:19:53 CEST 2013
#8231: Haskell's Run Time System doesn't save electricity
--------------------------+------------------------------------------------
Reporter: | Owner:
UnixJunkie | Status: new
Type: bug | Milestone:
Priority: normal | Version: 7.4.1
Component: | Operating System: Linux
Runtime System | Type of failure: None/Unknown
Keywords: energy | Test Case: provided in the description
saving | Blocking:
Architecture: x86_64 |
(amd64) |
Difficulty: |
Unknown |
Blocked By: |
Related Tickets: |
--------------------------+------------------------------------------------
Someone provided me with a sequential implementation of the fibonacci
function.
Out of curiosity, it was compiled with -threaded and we played with the -N
option of the runtime.
That same someone noticed some suspicious behavior.
I notice the same and so report about it: all cores specified by $np
are fully used while there is no change in the wallclock time
spent by the program.
The code:
---
{{{
import Text.Printf
fib :: Int -> Int
fib 0 = 0
fib 1 = 1
fib n = fib (n - 1) + fib (n - 2)
i = 44
main = printf "n=%d => %d\n" i (fib i)
}}}
---
The build:
---
{{{
ghc -threaded -O2 sequential_fib.hs
}}}
---
The run (on an eight cores machine), shell is Bash:
---
{{{
for np in `seq 1 8` ; do time ./sequential_fib +RTS -N$np ; done
}}}
---
The output:
---
{{{
n=44 => 701408733
real 0m10.838s
user 0m10.817s
sys 0m0.000s
n=44 => 701408733
real 0m10.762s
user 0m12.009s
sys 0m9.165s
n=44 => 701408733
real 0m10.774s
user 0m24.846s
sys 0m6.800s
n=44 => 701408733
real 0m10.769s
user 0m33.654s
sys 0m8.413s
n=44 => 701408733
real 0m11.222s
user 0m47.427s
sys 0m7.336s
n=44 => 701408733
real 0m11.217s
user 0m57.872s
sys 0m7.752s
n=44 => 701408733
real 0m11.208s
user 1m9.172s
sys 0m7.112s
n=44 => 701408733
real 0m11.204s
user 1m18.909s
sys 0m7.768s
}}}
---
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8231>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list