[FR] Allow rfun to optionally run in parallel over iters
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 171
- Forks
- 26
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 3
Description
Looking at the code for rfun and looking at the future dev guide I think that that we could allow users to optionally specify whether the rfun should be allowed to run over iterations in parallel.
plain(multicore)
my_fun = function(x, y) {
return x + y
}
# parallel_args is a list of args for `future.mapply`
my_fun_rvar = rfun(my_fun, c("x", "y"), parallel = TRUE, parallel_args = list(...))
plain(multicore)
x = # ...
y = # ...
z = my_fun_rvar(x, y)
I think we would just have to modify the signature like
rfun <- function (.f, rvar_args = NULL, ndraws = NULL, parallel = FALSE, parallel_args = list())
Then in the code when we call mapply we call future.mapply. I think for the parallel_args we would need to wrap future.mapply in a do.call as well but I can't remember rn
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in R/rvar-rfun.R at rfun and inspect the existing mapply call. Read the linked future package developer guide before determining how future.mapply and parallel_args fit the function interface. Done means rfun can optionally run over iterations in parallel while retaining the current serial behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100