Default to all cores for executables compiled with new flag -multicore
|Reported by:||tim.v2.0||Owned by:|
|Type of failure:||None/Unknown||Test Case:|
|Related Tickets:||Differential Rev(s):|
I propose a new flag -multicore, be added to the compiler which will generate an executable that will use all available cores by default. Runtime tuning can remain using the +RTS -Nx -RTS.
Currently, the Haskell wiki shows that you need to both set a compilation flag and a run-time flag to get multi-core support. The compiler flag -threaded is used to enable several disparate behaviors: multi-core support, interact with multi-threaded foreign code and make foreign calls without blocking other Haskell threads. Because of this, it is not always reasonable to use multiple cores for code compiled with -threaded.
Addition of a new flag will tell the compiler, "yes, make code that uses all the cores".
If this is considered too lenient, perhaps it could take an argument. -multicore 50 would use 50% of available cores. -multicore 75 would use 75% of available cores. Etc.
I find Haskell's requirement that I set both compile time and run time flags to use multiple cores obscure and annoying. It is hardly onerous, but it could definitely be improved.
This is filed in response to ticket 4307 being closed. Further, it is filed in response to StackOverflow post http://stackoverflow.com/questions/3704430/why-do-you-have-to-use-both-a-compiler-flag-and-a-run-time-flag-to-get-multicore