plan(cluster) runs gc() on the worker for each future since 1.67.0 (default gc = TRUE)
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 74/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- r
調査の方向性
まず ClusterFutureBackend()、launchFuture.ClusterFutureBackend()、receiveMessageFromWorker() を開始し、Issue の ms_per_future() の例を再現します。Worker のガベージコレクションのデフォルト値を FALSE にするべきかを判断してください。維持する場合は、NEWS.md と ?cluster を更新します。完了とは、選択したデフォルト値がテストされ、意図した動作が文書化されていることを意味します。
索引モデルが issue の本文から書いたものです。
説明
Since future 1.67.0, plan(cluster) runs gc() on the worker before and after each future. With 2 local workers, value(future(1)) takes about 310 ms with plan(cluster) and about 45 ms with plan(multisession), a factor of about 7. With ggplot2, dplyr, Matrix and lme4 loaded on the workers (44 namespaces per worker), plan(cluster) takes about 555 ms.
Is gc = TRUE the intended default for plan(cluster)? The NEWS.md of 1.67.0 does not mention this change, and it is possible that is not intended. ClusterFutureBackend() has the default gc = TRUE. MultisessionFutureBackend() has gc = FALSE. In 1.58.0, cluster() had the argument gc = FALSE, so plan(cluster) did not run gc(). In 1.67.0 and in the development version (1.82.0-9036), cluster() has no gc argument, so the default of the backend applies.
With gc = TRUE, launchFuture.ClusterFutureBackend() calls gc() on the worker before the future, and receiveMessageFromWorker() calls gc() on the worker again after the result.
Here's an example code
library(future)
ms_per_future <- function(n = 20) {
invisible(value(future(1)))
t0 <- proc.time()[["elapsed"]]
for (i in seq_len(n)) value(future(1))
1000 * (proc.time()[["elapsed"]] - t0) / n
}
plan(cluster, workers = 2)
ms_per_future()
# ms per future: 304 to 315
plan(cluster, workers = 2, gc = FALSE)
ms_per_future()
# ms per future: 45
plan(multisession, workers = 2)
ms_per_future()
# ms per future: 45
plan(multisession, workers = 2, gc = TRUE)
ms_per_future()
# ms per future: 300 to 319
# Workers with ggplot2, dplyr, Matrix and lme4 loaded (44 namespaces per
# worker in the runs below; install these packages first):
plan(sequential)
cl <- parallelly::makeClusterPSOCK(2)
invisible(parallel::clusterCall(cl, function() {
for (p in c("ggplot2", "dplyr", "Matrix", "lme4")) loadNamespace(p)
}))
plan(cluster, workers = cl)
ms_per_future()
# ms per future: 554 to 558
plan(cluster, workers = cl, gc = FALSE)
ms_per_future()
# ms per future: 45
plan(sequential)
parallel::stopCluster(cl)
Code that makes many small futures on a cluster runs slower. For example, In the test suite of the projpred package, the parallel tests took 566 s with the default and 174 s with gc = FALSE.
gc = FALSE as the default of ClusterFutureBackend() would restore the behavior of 1.58.0.
If gc = TRUE is intended, it would be good to mention it in NEWS.md and in ?cluster
Thanks for maintaining future!
- 主要言語
- R
- スター
- 1k
- フォーク
- 93
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 1
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
futureverse/future のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 35/100
futureverse/future#849 ·
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
futureverse/future#833 ·
-
feature/resources RNG
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
futureverse/future#832 ·
-
RNG
難易度 5/5 1週間以上 初心者へのやさしさ 38/100
futureverse/future#831 · コメント 1 件 ·
-
feature request
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
futureverse/future#822 · リアクション 1 件 ·
futureverse/future の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
nf-core/provenancereport#75 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
garner-code/PsyR#80 ·