[GHC] #14545: -prof causes -N to default to 1

GHC ghc-devs at haskell.org
Wed Nov 29 23:52:54 UTC 2017


#14545: -prof causes -N to default to 1
-------------------------------------+-------------------------------------
        Reporter:  gelisam           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.2
      Resolution:                    |             Keywords:
Operating System:  MacOS X           |         Architecture:  x86_64
 Type of failure:  Incorrect result  |  (amd64)
  at runtime                         |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Description changed by gelisam:

Old description:

> Given a simple test program which prints `getNumCapabilities`:
>
> {{{#!hs
> import Control.Concurrent
>
> main :: IO ()
> main = print =<< getNumCapabilities
> }}}
>
> Compiling this with `-threaded` and running the program with `+RTS -N` is
> supposed to set the number of capabilities to the number of cores on the
> machine. This normally prints 8 on my machine:
>
> {{{#!bash
> $ rm -rf Main Main.hi Main.o && ghc -threaded Main.hs && ./Main +RTS -N
> [1 of 1] Compiling Main             ( Main.hs, Main.o )
> Linking Main ...
> 8
> }}}
>
> But when I compile with `-prof`, it prints 1 instead! Expected output:
> still 8.
>
> {{{#!bash
> $ rm -rf Main Main.hi Main.o && ghc -prof -threaded Main.hs && ./Main
> +RTS -N
> [1 of 1] Compiling Main             ( Main.hs, Main.o )
> Linking Main ...
> 1
> }}}
>
> If I use `+RTS -N8` instead, it prints 8 as expected.
>
> Reproduced with GHC 8.0.2 and GHC 8.8.2.

New description:

 Given a simple test program which prints `getNumCapabilities`:

 {{{#!hs
 import Control.Concurrent

 main :: IO ()
 main = print =<< getNumCapabilities
 }}}

 Compiling this with `-threaded` and running the program with `+RTS -N` is
 supposed to set the number of capabilities to the number of cores on the
 machine. This normally prints 8 on my machine:

 {{{#!bash
 $ rm -rf Main Main.hi Main.o && ghc -threaded Main.hs && ./Main +RTS -N
 [1 of 1] Compiling Main             ( Main.hs, Main.o )
 Linking Main ...
 8
 }}}

 But when I compile with `-prof`, it prints 1 instead! Expected output:
 still 8.

 {{{#!bash
 $ rm -rf Main Main.hi Main.o && ghc -prof -threaded Main.hs && ./Main +RTS
 -N
 [1 of 1] Compiling Main             ( Main.hs, Main.o )
 Linking Main ...
 1
 }}}

 If I use `+RTS -N8` instead, it prints 8 as expected.

 Reproduced with GHC 8.0.2 and GHC 8.2.2.

--

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14545#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list