开始使用免费开始使用

这台机器有多少个内核?

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
___
编辑并运行代码