0
我一直在關注RWH中的concurrency chapter。我一直在嘗試本書中提到的示例程序。以下是代碼:numCapabilities不顯示正確的核心數
test.hs:
import GHC.Conc (numCapabilities)
main = do
putStrLn $ "number of cores: " ++ show numCapabilities
這是我如何執行它們:
$ ghc -c test.hs
$ ghc -threaded -o test test.o
$ ./test -RTS -N4
number of cores: 1
但我似乎有四個核心:
$ nproc
4
$ cat /proc/cpuinfo
Produces a big output. But shows four processors. (0..3).
任何我做錯了什麼想法?
是不是應該是'./test + RTS -N4 -RTS'? – bheklilr
@bheklilr啊是的。捂臉。 – Sibi
它發生在我們所有人身上,很高興這是一個簡單的修復 – bheklilr