R mclapply vs foreach

前端 未结 2 1695
鱼传尺愫
鱼传尺愫 2021-02-07 06:27

I use mclapply for all my \"embarassingly parallel\" computations. I find it clean and easy to use, and when arguments mc.cores = 1 and mc.preschedule = TRUE

2条回答
  •  隐瞒了意图╮
    2021-02-07 06:52

    As Steve Weston (author of foreach) says here, using foreach with doParallel as backend you can initialize workers. This can be helpful for setting up a database connection more efficiently once per worker instead of once per task.

提交回复
热议问题