How to find the number of cores at runtime in Haskell

前端 未结 5 1659
野趣味
野趣味 2021-02-13 06:22

Does Haskell have a method for determining the number of CPU cores present on a machine at runtime?

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-13 06:30

    Since base 4.5 you can use getNumProcessors from GHC.Conc. This is good since the number of capabilities can now be set dynamically with setNumCapabilities from the same.

提交回复
热议问题