Skip to content

Parallelization does not appear to work #20

@gregpoore

Description

@gregpoore

Hi there,

I've been trying out ConQurRand like what I see so far. One challenge that I've run into is that the parallelization seems to either not work or be minimally effective, and this makes it very difficult to apply the tool to larger datasets. For example, adapting some code from the tutorial to compare runtime on 2 cores vs. 8 cores vs. 10 cores (on a Macbook Pro):

library(ConQuR)
library(doParallel) 
library(tictoc)

data(Sample_Data)
batchid = Sample_Data[, 'batchid']
covar = Sample_Data[, c('sex', 'race', 'age', 'sbp')]

tic("ConQuR with 2 cores")
taxa_corrected = ConQuR(num_core = 2,
                         tax_tab=taxa, batchid=batchid, 
                         covariates=covar, batch_ref="0")
toc() # --> ConQuR with 2 cores: 30.613 sec elapsed

tic("ConQuR with 8 cores")
taxa_corrected = ConQuR(num_core = 8,
                         tax_tab=taxa, batchid=batchid, 
                         covariates=covar, batch_ref="0")
toc() # --> ConQuR with 8 cores: 28.187 sec elapsed

tic("ConQuR with 10 cores")
taxa_corrected = ConQuR(num_core = 10,
                        tax_tab=taxa, batchid=batchid, 
                        covariates=covar, batch_ref="0")
toc() # --> ConQuR with 8 cores: 28.071 sec elapsed

I've made sure that no other special packages are loaded when running the above, and a gain of ~6% speed-up for 5X as many cores is perplexing.

Do you know if/why parallelization is not speeding things up, and how it can be fixed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions