Suppose I want to use SharedObject with BiocParallel, e.g.:
library(BiocParallel)
library(SharedObject)
library(assertthat)
## Where will these workers run?
register(BatchtoolsParam())
x <- share(1:10)
res <- unlist(bplapply(x, sqrt))
assert_that(all(res == sqrt(x)))
Some BiocParallel params (e.g. batchtools, Redis, future) can potentially run on multiple machines. Will shared objects work in this case? My guess is no, because I can't imagine how this would work in the general case. Perhaps they might be smart enough under the hood to make this work for the read-only case by copying the value to the workers.
Assuming the above code can't be guaranteed to work for all parallel backends, how can we practically use SharedObject with BiocParallel and other parallel frameworks with the potential to parallelize across multiple hosts? Do we need to check which parallel backend is in use and fall back to a separate non-SharedObject implementation if the backend is using multiple hosts?
Suppose I want to use SharedObject with BiocParallel, e.g.:
Some BiocParallel params (e.g. batchtools, Redis, future) can potentially run on multiple machines. Will shared objects work in this case? My guess is no, because I can't imagine how this would work in the general case. Perhaps they might be smart enough under the hood to make this work for the read-only case by copying the value to the workers.
Assuming the above code can't be guaranteed to work for all parallel backends, how can we practically use SharedObject with BiocParallel and other parallel frameworks with the potential to parallelize across multiple hosts? Do we need to check which parallel backend is in use and fall back to a separate non-SharedObject implementation if the backend is using multiple hosts?