Skip to content

-prof causes -N to default to 1

Given a simple test program which prints getNumCapabilities:

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:

$ 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.

$ 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.

Edited by gelisam
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information