Skip to content

Speedup

Laura A DeCicco requested to merge speedup into main

Here's the code that allows us to run the modelEstimations in paralell:

library(doParallel)
library(parallel)
library(WRTDSplus)

nCores <- detectCores(logical = FALSE) - 1
nCores

eList_stfa <- readRDS("eList_stfa.rds")

#########################################################
system.time({
  cl <- makeCluster(nCores)
  registerDoParallel(cl)
  eListp <- model4DEstimation(eList_stfa, 
                              windowZ = 0.094,
                              nVectorZ = 7,
                              verbose = FALSE,
                              run.parallel = TRUE)  
  stopCluster(cl)
})
   user  system elapsed 
  11.06    2.14   75.17

eList_stfa2 <- model4DEstimation(eList_stfa, 
                                windowZ = 0.094, 
                                nVectorZ = 7,
                                run.parallel = FALSE)
})
user  system elapsed 
 267.40    2.81  273.01
#####################################################


#####################################################
system.time({
  cl <- makeCluster(nCores)
  registerDoParallel(cl)
  eListp <- modelEstimation_ReplaceQ(eList_stfa, 
                              windowZ = 0.094,
                              verbose = FALSE,
                              run.parallel = TRUE)  
  stopCluster(cl)
})
user  system elapsed 
3.17    0.28   12.19 

system.time({
eList_stfa3 <- modelEstimation_ReplaceQ(eList_stfa, 
                                 windowZ = 0.094, 
                                 run.parallel = FALSE)
})
user  system elapsed 
33.32    0.28   33.58 
###############################################################

###############################################################
system.time({
  cl <- makeCluster(nCores)
  registerDoParallel(cl)
  eListp <- model4DEstimation_ReplaceQ(eList_stfa, 
                                     windowZ = 0.094,
                                     windowZ2 = 0.094,
                                     nVectorZ2 = 7, 
                                     nVectorZ = 7,
                                     verbose = FALSE,
                                     run.parallel = TRUE)  
  stopCluster(cl)
})
user  system elapsed 
6.56    1.28   47.17 

system.time({
  eListp <- model4DEstimation_ReplaceQ(eList_stfa, 
                                       windowZ = 0.094,
                                       windowZ2 = 0.094,
                                       nVectorZ2 = 7, 
                                       nVectorZ = 7,
                                       verbose = FALSE,
                                       run.parallel = FALSE) 
})
user  system elapsed 
 152.34    0.96  153.29 

Merge request reports

Loading