Can dmn {DirichletMultinomial} be run on multiple cpu cores in R?
1
1
Entering edit mode
4.2 years ago
mschmidt ▴ 80

I analyse microbiome data using

library(phyloseq)
library(microbiome)
library(DirichletMultinomial)

and several other libraries. Fitting Dirichlet-Multinomial models to count data dmn {DirichletMultinomial} takes quite a long time. Can the computation be run on multiple cpu cores in R. I tried:

dat <- abundances(pseq)
count <- as.matrix(t(dat))
fit <- lapply(1:25, dmn, count = count, verbose=TRUE)

replacing with:

library(parallel)
numCores <- detectCores()
...
fit <- mclapply(1:25, dmn, count = count, verbose=TRUE, mc.cores = numCores)

but it returns errorWarning message: In mclapply(1:25, dmn, count = count, verbose = TRUE, mc.cores = numCores) : all scheduled cores encountered errors in user code

I am using

R version 4.0.2 (2020-06-22) -- "Taking Off Again"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin17.0 (64-bit)
> detectCores()
[1] 4

Can anyone help?

Best regards, Marcin

R multi-core Dirichelet microbiome parallel • 945 views
ADD COMMENT
0
Entering edit mode
4.2 years ago
mschmidt ▴ 80

the fit <- mclapply(1:25, dmn, count = count, verbose=TRUE, mc.cores = numCores) works, I had to update some libraries

ADD COMMENT

Login before adding your answer.

Traffic: 2178 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6