Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get number of RTS threads in Haskell program?

Is there an IO action that gives me the number of OS threads the RTS was initialized with? It would be nice to be able to use this as an argument to the parBuffer function from the Control.Parallel.Strategies module.

like image 832
Edward Avatar asked Oct 28 '10 19:10

Edward


1 Answers

Assuming GHC, you could use GHC.Conc.numCapabilities to get the argument to +RTS -N.

like image 70
kennytm Avatar answered Sep 26 '22 00:09

kennytm