這台機器有多少個核心?
parallel 套件有個函式 detectCores(),可以用來判定機器上的核心數量。
這台機器有多少個核心?
本練習屬於課程
撰寫高效 R 程式碼
練習說明
- 載入
parallel套件。 - 使用
detectCores()函式,將核心數量存到名為no_of_cores的物件中。 - 列印
no_of_cores。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Load the parallel package
___
# Store the number of cores in the object no_of_cores
no_of_cores <- ___
# Print no_of_cores
___