Skip to content

Conversation

@mattfidler
Copy link
Contributor

@mattfidler mattfidler commented Oct 24, 2024

Hi @andrewhooker

This allows windows based PopED models from babelmixr2 to be run in parallel without modifying any user code. This mean the same user code works on windows and linux/mac

@mattfidler
Copy link
Contributor Author

In general it saves the babelmixr2 environment inside of the poped.db setup from babelmixr2. With the windows parallelization, this environment is sent to every R process node to load the DLLs. This will allow everything to be contained inside of babelmixr2 in case things like symbolic sensitivity gradient models are added to speed up PopED and rxode2. Right now there are 2 models/dlls generated for each poped database.

@mattfidler
Copy link
Contributor Author

Had to add babelmixr2 development stack so these check correctly. After adding this to CRAN you can take out the babelmixr2 stack and can simply use the CRAN version.

@codecov
Copy link

codecov bot commented Oct 24, 2024

Codecov Report

❌ Patch coverage is 60.97561% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 44.68%. Comparing base (73bccdc) to head (d13e906).

Files with missing lines Patch % Lines
R/start_parallel.R 0.00% 5 Missing ⚠️
R/optimize_n.R 40.00% 3 Missing ⚠️
R/blockexp.R 0.00% 2 Missing ⚠️
R/ind_estimates.R 0.00% 2 Missing ⚠️
R/LEDoptim.R 0.00% 1 Missing ⚠️
R/LinMatrixLH.R 50.00% 1 Missing ⚠️
R/LinMatrixL_occ.R 0.00% 1 Missing ⚠️
R/blockopt.R 0.00% 1 Missing ⚠️
R/blockother.R 0.00% 1 Missing ⚠️
R/create_ofv.R 0.00% 1 Missing ⚠️
... and 14 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #79      +/-   ##
==========================================
+ Coverage   44.52%   44.68%   +0.15%     
==========================================
  Files         120      121       +1     
  Lines        8810     8892      +82     
==========================================
+ Hits         3923     3973      +50     
- Misses       4887     4919      +32     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mattfidler
Copy link
Contributor Author

As babelmixr2 was released on CRAN development libraries are no longer neeeded.

@mattfidler
Copy link
Contributor Author

The error in oldrel-1 is unrelated to this pull request.

@mattfidler
Copy link
Contributor Author

Thanks Andy!

@mattfidler mattfidler closed this Nov 15, 2025
@mattfidler mattfidler reopened this Nov 15, 2025
Copy link
Owner

@andrewhooker andrewhooker Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to add

start_parallel_env <- new.env(parent=emptyenv())
start_parallel_env$babelmixr2 <- NULL

outside of the function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is so it can be assigned in a global like environment.

The actual function is

parallel::clusterCall(cl, babelmixr2::.popedCluster, start_parallel_env$babelmixr2)

@andrewhooker
Copy link
Owner

Hi Matt,

Thanks for all your work on this. I am wondering if there is any way to achieve the same result without having to add the following code snippet in, essentially, every PopED function?

start_parallel_env$babelmixr2 <- poped.db$babelmixr2

Could you supply a minimal working example that I could test a bit with? My thought is that it should be a bit more efficient to just pass poped.db to start.parallel()

Andy

@mattfidler
Copy link
Contributor Author

parallel::clusterCall(cl, babelmixr2::.popedCluster, start_parallel_env$babelmixr2)

Hi Matt,

Thanks for all your work on this. I am wondering if there is any way to achieve the same result without having to add the following code snippet in, essentially, every PopED function?

start_parallel_env$babelmixr2 <- poped.db$babelmixr2

Could you supply a minimal working example that I could test a bit with? My thought is that it should be a bit more efficient to just pass poped.db to start.parallel()

Andy

I originally tried this, but it dropped the $babelmixr2 in some functions. Perhaps you know how to keep it from dropping.

@mattfidler
Copy link
Contributor Author

I simply used your examples and modified it.

You could try the warfarin one:

https://github.com/nlmixr2/babelmixr2/blob/175ca39b033df3b5020b7769157c175721abf29f/inst/poped/ex.2.c.warfarin.ODE.compiled.babelmixr2.R

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants