From e5b327ab51fd429eb7407ee28afede0abe1455e2 Mon Sep 17 00:00:00 2001 From: Matthew L Fidler Date: Thu, 24 Oct 2024 00:38:27 -0500 Subject: [PATCH] Add PopED win parallel --- .gitignore | 1 + NAMESPACE | 1 + R/poped.R | 23 +++++++++++++---------- man/dot-popedCluster.Rd | 21 +++++++++++++++++++++ 4 files changed, 36 insertions(+), 10 deletions(-) create mode 100644 man/dot-popedCluster.Rd diff --git a/.gitignore b/.gitignore index 478f35a6..5707e081 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ inst/doc /vignettes/pk.turnover.emax3-nonmem/pk.turnover.emax3-rounding.qs /vignettes/articles/pk.turnover.emax3-nonmem/pk.turnover.emax3-rounding.qs /vignettes/articles/pk.turnover.emax4-nonmem/pk.turnover.emax4.qs +/src/Makevars.win diff --git a/NAMESPACE b/NAMESPACE index a751a813..b922b903 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -134,6 +134,7 @@ S3method(rxUiGet,popedScriptBeforeCtl) S3method(rxUiGet,popedSettings) S3method(rxUiGet,popedSigma) export(.minfo) +export(.popedCluster) export(.popedF) export(.popedFree) export(.popedRxRunSetup) diff --git a/R/poped.R b/R/poped.R index dbeb4dc9..e279ac24 100644 --- a/R/poped.R +++ b/R/poped.R @@ -344,21 +344,11 @@ rxUiGet.popedFfFun <- function(x, ...) { poped.db$babelmixr2$optTime) .ret <- try(.popedSolveIdME(.p, .u, .xt, model_switch, .(length(.predDf$cond)), .id-1, .totn), silent=TRUE) - if (inherits(.ret, "try-error")) { - rxode2::rxLoad(poped.db$babelmixr2$modelMT) - .ret <- .popedSolveIdME(.p, .u, .xt, model_switch, .(length(.predDf$cond)), - .id-1, .totn) - } } else if (.lu > .(.poped$maxn)) { .p <- p[-1] poped.db <- .popedRxRunFullSetupMe(poped.db, .xt, model_switch) .ret <- try(.popedSolveIdME2(.p, .u, .xt, model_switch, .(length(.predDf$cond)), .id-1, .totn), silent=TRUE) - if (inherits(.ret, "try-error")) { - rxode2::rxLoad(poped.db$babelmixr2$modelF) - .ret <- .popedSolveIdME2(.p, .u, .xt, model_switch, .(length(.predDf$cond)), - .id-1, .totn) - } } return(list(f=matrix(.ret$rx_pred_, ncol=1), poped.db=poped.db)) @@ -3132,3 +3122,16 @@ babelBpopIdx <- function(popedInput, var) { stop("cannot find '", var, "' in the baelmixr2 poped model", call.=FALSE) } + +#' Internal function to use with PopED to run PopED in parallel on Windows +#' +#' @param babelmixr2 environment in poped environment +#' @return nothing, called for side effects +#' @export +#' @author Matthew L. Fidler +#' @keywords internal +.popedCluster <- function(babelmixr2) { + rxode2::rxLoad(babelmixr2$modelF) + rxode2::rxLoad(babelmixr2$modelMT) + invisible() +} diff --git a/man/dot-popedCluster.Rd b/man/dot-popedCluster.Rd new file mode 100644 index 00000000..73a4f2ce --- /dev/null +++ b/man/dot-popedCluster.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/poped.R +\name{.popedCluster} +\alias{.popedCluster} +\title{Internal function to use with PopED to run PopED in parallel on Windows} +\usage{ +.popedCluster(babelmixr2) +} +\arguments{ +\item{babelmixr2}{environment in poped environment} +} +\value{ +nothing, called for side effects +} +\description{ +Internal function to use with PopED to run PopED in parallel on Windows +} +\author{ +Matthew L. Fidler +} +\keyword{internal}