PopED icon indicating copy to clipboard operation
PopED copied to clipboard

Parallelization with an mrgsolve model on Windows

Open Vincent-AC opened this issue 6 years ago • 2 comments

Hello,

Thank you for this great tool ! I was trying to optimize some dosing regimens using an mrgsolve model as input for PopED. My OS is Windows 10. It worked fine while mono-threading but when paralellizing i did get this annoying error message :

There was a problem accessing the model shared object.
Either the model object is corrupted or  
  the model was not properly compiled and/or loaded.
Check mrgsolve:::funset(mod) for more information.

After some research I stumbled upon this issue in the mrgsolve github (https://github.com/metrumresearchgroup/mrgsolve/issues/471) where the authors suggested to use the loadso() command to load the model. After trying multiple different places to put this commnad (in the ff.model function for example, makes R crash on my computer), I finally found that by editing the start_parallel script adding these few lines made the parallelization work like a charm :

      # load mrgsolve models in workers using loadso
      if (!is.null(mrgsolve_model)) {
        parallel::clusterCall(cl, loadso, x=mrgsolve_model)
      }

I forked the repository (https://github.com/Vincent-AC/PopED) and added this to the package, would you be interested in a pull request ?

Vincent-AC avatar Jun 20 '19 17:06 Vincent-AC

Hi Vincent,

Thanks for the nice work!  I’d be happy to get a pull request from you.

Best regards, Andrew

Andrew Hooker, Ph.D. Associate Professor of Pharmacometrics Dept. of Pharmaceutical Biosciences Uppsala University Box 591, 751 24, Uppsala, Sweden Phone: +46 18 471 4355 Mobile: +46 768 000 725 http://www.farmbio.uu.se/research/researchgroups/pharmacometrics/ On 20 Jun 2019, 19:27 +0200, Vincent ARANZANA-CLIMENT [email protected], wrote:

Hello, Thank you for this great tool ! I was trying to optimize some dosing regimens using an mrgsolve model as input for PopED. My OS is Windows 10. It worked fine while mono-threading but when paralellizing i did get this annoying error message : There was a problem accessing the model shared object. Either the model object is corrupted or the model was not properly compiled and/or loaded. Check mrgsolve:::funset(mod) for more information. After some research I stumbled upon this issue in the mrgsolve github (metrumresearchgroup/mrgsolve#471) where the authors suggested to use the loadso() command to load the model. After trying multiple different places to put this commnad (in the ff.model function for example, makes R crash on my computer), I finally found that by editing the start_parallel script adding these few lines made the parallelization work like a charm : # load mrgsolve models in workers using loadso if (!is.null(mrgsolve_model)) { parallel::clusterCall(cl, loadso, x=mrgsolve_model) } I forked the repository (https://github.com/Vincent-AC/PopED) and added this to the package, would you be interested in a pull request ? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

andrewhooker avatar Jul 02 '19 09:07 andrewhooker

You are welcome, the pull request is up !

Vincent

Vincent-AC avatar Jul 02 '19 11:07 Vincent-AC