[Bioc-devel] What is good convention for package-local BiocParallel param?

Shian Su @u@@ @ending from wehi@edu@@u
Fri Jan 11 00:59:27 CET 2019

Hello Developers,

I’m using BiocParallel for parallelism, and I understand that register() is the recommended method for setting threads. But I am reluctant to ask people to run code for my package which changes how other packages operate, so I figured I’d use local bp params. Recent discussions of RNG has made me worried there may be hidden state gotcha’s I’ve not considered. The current implementation is

set_mypkg_threads <- function(n) {
if (n == 1) {
options(“mypkg.bpparam” = SerialParam())
} else if (n > 1) {
if (.Platform$OS.type == "windows") {
options(“mypkg.bpparam" = SnowParam(nthreads))
} else {
options(“mypkg.bpparam" = MulticoreParam(nthreads))

Then elsewhere in my package I make use of parallelism as follows

BPPARAM = getOption(“mypkg.bpparam”, bpparam()),

Where getOption() either retrieves my set option or the default value given by bpparam(). So the behaviour is that if users have not registered params for my package specifically then it will take the BiocParallel default, but otherwise it will use my package’s local bpparam.

Also I know that as currently implemented, I preclude cluster parallelism on non-Windows machines. But it’s easy to fix. Just looking for feedback on the approach.

Kind regards,
Shian Su


The information in this email is confidential and intended solely for the addressee.
You must not disclose, forward, print or use it without the permission of the sender.

The Walter and Eliza Hall Institute acknowledges the Wurundjeri people of the Kulin
Nation as the traditional owners of the land where our campuses are located and
the continuing connection to country and community.

	[[alternative HTML version deleted]]

More information about the Bioc-devel mailing list