nlmixr2 / babelmixr2

The goal of babelmixr2 is to interface nlmixr2 with other pharmacometric tools
https://nlmixr2.github.io/babelmixr2/
8 stars 1 forks source link

poped - parallelization gives error #137

Closed TheoPapath closed 1 month ago

TheoPapath commented 1 month ago

Example ex.2.d.warfarin.ED.babelmixr2.R line 81

This may be a local issue, but I have noticed that I am getting the following error when parallelization is switched on:

image

mattfidler commented 1 month ago

This is a windows issue for babelmixr2. The parallelization spawns independent R processes. In these R processes the DLL for the model is not loaded in R so it cannot run the model.

mattfidler commented 1 month ago

It isn't clear if on Linux if the results would be the same; it is possible that this could corrupt the solver as written if it tries to run in parallel (via a fork in unix/mac)

mattfidler commented 1 month ago

In parallel for my linux machine this gives:

===============================================================================
FINAL RESULTS
Optimized Sampling Schedule
Group 1:  1e-05    0.5  4.898      6  7.347  80.82  100.4  115.1

OFV = 56.6036

Efficiency:
  ((exp(ofv_final) / exp(ofv_init))^(1/n_parameters)) = 1.1567

Expected relative standard error
(%RSE, rounded to nearest integer):
      Parameter   Values   RSE_0   RSE
            tCl     0.15       5     5
             tV        8       3     3
            tKA        1      14    14
       d_eta.cl     0.07      30    30
        d_eta.v     0.02      37    32
       d_eta.ka      0.6      27    28
   sig_prop.var     0.01      31    26
    sig_add.var     0.25      25    16

Total running time: 83.346 seconds
mattfidler commented 1 month ago

Without a parallel run:

===============================================================================
FINAL RESULTS
Optimized Sampling Schedule
Group 1:      1  4.898  4.898  4.898  7.347  97.96  102.9  115.1

OFV = 56.6684

Efficiency:
  ((exp(ofv_final) / exp(ofv_init))^(1/n_parameters)) = 1.1691

Expected relative standard error
(%RSE, rounded to nearest integer):
      Parameter   Values   RSE_0   RSE
            tCl     0.15       5     5
             tV        8       3     3
            tKA        1      14    14
       d_eta.cl     0.07      30    31
        d_eta.v     0.02      37    30
       d_eta.ka      0.6      27    28
   sig_prop.var     0.01      31    22
    sig_add.var     0.25      25    19

Total running time: 490.477 seconds
mattfidler commented 1 month ago

Which means parallel and non-parallel gives different results.

mattfidler commented 1 month ago

To have parallelization in PopED, patches are needed to PopED:

https://github.com/andrewhooker/PopED/pull/79

As well as the pull request #141

mattfidler commented 1 month ago

I will consider this closed for now.

mattfidler commented 1 month ago

Installing PopED from my branch would be needed if you wish to test this on your own:

devtools::install_github("mattfidler/PopED", ref="babelmixr2-win")