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:
It seems somewhat onerous to have flags one must set both at compile time and again at run time. Are these flags vestigial remains of the effort to add concurrency to GHC?
While you’re developing the program the extra
+RTS ...shouldn’t be a big deal (though I admit it struck me as odd when I first picked up Haskell). For the final (shipped) binary you can link it with static RTS options (GHC manual) by providing a C file containingchar *ghc_rts_opts = "-N";.EDIT: Updating this question for GHC 7.x, there is now a way to specify RTS options at compile time:
This 1) uses the threaded runtime system 2) Enables the RTS options 3) Sets the RTS option to use as many threads as there are cores available (use
-Nxwherexis a number to manually control the number of OS threads).