role-model / roleR

R package implementing the RoLE model
https://role-model.github.io/roleR
GNU General Public License v3.0
1 stars 2 forks source link

testing paralellization #125

Closed diazrenata closed 1 year ago

diazrenata commented 1 year ago

Notes from 5/23:

> p <- roleParams(niter = 50000)
> e <- roleExperiment(list(p, p, p, p, p, p, p, p,p,p,p,p,p,p,p,p, p, p, p,p,p,p,p,p,p,p,p, p, p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p, p, p, p, p, p, p, p,p,p,p,p,p,p,p,p, p, p, p,p,p,p,p,p,p,p,p, p, p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p, p, p, p, p, p, p, p,p,p,p,p,p,p,p,p, p, p, p,p,p,p,p,p,p,p,p, p, p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p))
> system.time(runRole(e))
   user  system elapsed 
 15.815   1.025  16.833 
> system.time(runRole(e, cores = 3))
   user  system elapsed 
 14.137   1.256  20.776 

^^ bad example, most of the overhead is in scheduling the runs.

With some that are longer to run you do see time savings:

> p <- roleParams(niter = 500000)
> e <- roleExperiment(list(p, p, p))
> system.time(runRole(e))
   user  system elapsed 
  3.892   0.413   4.312 
> system.time(runRole(e, cores = 3))
   user  system elapsed 
  0.195   0.049   3.804 
diazrenata commented 1 year ago

Parallelization appears to work; there are trade-offs. A large number of fast role models maybe has high scheduling overhead such that doing a bunch of tiny ones isn't a big time savings on a 4 core machine.

diazrenata commented 1 year ago

Thoughts for now (can close this):