blog icon indicating copy to clipboard operation
blog copied to clipboard

could not find function "init_status.icm"

Open jbbinder8 opened this issue 4 years ago • 3 comments

In the project modelling-the-effects-of-public-health-interventions-on-covid-19-transmission-part-2

When I run the command

baseline_sim <- simulate(ncores=4)

I get the error

Error in { : task 1 failed - "could not find function "init_status.icm""

I'm using Windows. Please, what could I do to fix?

Changing ncores to 1 prevents the error to happen.

jbbinder8 avatar Mar 22 '20 23:03 jbbinder8

I believe that the issue here is the way the code handles the parallelization process in "_icm.icm.seiqhrf". While I'm no expert, I think this comes from the fact that Tim has a Mac computer which allows to use some packages that we cannot use in Windows. The solution I found was to use the "doFuture" package en change the doParallel part with

library("doFuture") registerDoFuture() plan(multiprocess)

AngelZweig86 avatar Mar 27 '20 21:03 AngelZweig86

Elaborating on my previous post, since doFuture is quite slow you can actually use the following expansion to the doParallel call

sout <- foreach(s = 1:nsims, .export = c('infection.seiqhrf.icm','arrivals.seiqhrf.icm',
                                         'control.icm','cum_discr_si','departures.seiqhrf.icm',
                                         'get_prev.seiqhrf.icm','init_status.icm','initialize.icm',
                                         'saveout.seiqhrf.icm','infection.seiqhrf.icm','progress.seiqhrf.icm'),
                
                .packages = 'EpiModel') %dopar% {

AngelZweig86 avatar Mar 28 '20 00:03 AngelZweig86

same problem. Windows users Just change or add ncores=1 when running simulate function, it might take time but it works!

XiangBu avatar Mar 29 '20 09:03 XiangBu