Skip to Content
R 语言经典实例(原书第 2 版)
book

R 语言经典实例(原书第 2 版)

by J.D. Long, Paul Teetor
June 2020
Beginner to intermediate
522 pages
9h 6m
Chinese
China Machine Press
Content preview from R 语言经典实例(原书第 2 版)
386
12
#>
#> value
plan(multiprocess)
tic("simulate pi - parallel")
sims_list <- future_map(draw_list, simulate_pi)
toc()
#> simulate pi - parallel: 26.33 sec elapsed
mean(unlist(sims_list))
#> [1] 3.14
前面的示例在 MacBook Pro 上运行,包含有四个物理内核和两个虚拟内核。当你并行运
行代码时,最佳情况是运行时间减少到 1/(物理内核数)。通过四个物理内核,你可以
看到并行运行时比单线程运行快得多,但不是单线程运行时的四分之一。内核间移动数
据总会花一些时间,因此你永远不会遇到最佳情况。每次迭代产生的数据越多,你在并
行化方面的速度提升就越少。
12.21.4 另请参阅
参见 12.22 节。
12.22 远程并行运行 R 代码
12.22.1 问题
你可以访问许多远程计算机,需要在它们之间并行运行代码。
12.22.2 解决方案
在多台机器上并行运行代码最初可能很难设置。但是,如果我们从一些关键预设条件开
始,那么该过程的成功概率要高得多。
首要条件是:
你可以使用以前生成的 SSH 密钥,从主机到每个远程节点进行保密通信(ssh)而无
须密码。
远程节点都安装了 R(理想情况下是 R 的相同版本)。
设置路径,以便你可以从 SSH 运行 Rscript
远程节点安装了 furrr 包(该添加包将会安装 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

机器学习实战:基于Scikit-Learn、Keras 和TensorFlow (原书第2 版)

机器学习实战:基于Scikit-Learn、Keras 和TensorFlow (原书第2 版)

Aurélien Géron
大规模数据分析和建模:基于 Spark 与 R

大规模数据分析和建模:基于 Spark 与 R

Javier Luraschi, Kevin Kuo, Edgar Ruiz
管理Kubernetes

管理Kubernetes

Brendan Burns, Craig Tracey

Publisher Resources

ISBN: 9787111656814