Why do you have to use both a compiler flag and a run-time flag to get multicore-support in Haskell?

The Haskell wiki shows that you need to both set a compilation flag and a run-time flag to get multi-core support. Why isn't using the library enough to get the correct behavior at compile time? Why can't the run-time executable detect it was compiled with -threaded and use all cores on the system unless otherwise specified? I think turning these on by default would be better. Then there could be flags to turn off or modify these features.

http://www.haskell.org/haskellwiki/GHC/Concurrency#Multicore_GHC says:

  • Скомпилируйте вашу программу с помощью переключателя -threaded.
  • Запустите программу с + RTS -N2, например, чтобы использовать 2 потока. Вы должны использовать значение -N, равное количеству ядер ЦП на вашем компьютере (не включая ядра с гиперпоточностью).


    Кажется несколько обременительным иметь флаги, которые нужно устанавливать как во время компиляции, так и снова во время выполнения. Являются ли эти флаги рудиментом усилий по добавлению параллелизма в GHC?

  • 19
    задан Don Stewart 22 April 2011 в 22:12
    поделиться