R/test-threads.R
test_threads.Rd
Takes a model object and runs it with various threads values
bbi_model object to copy/test.
Integer vector of threads values to test.
a named list.
Maximum number of iterations for NONMEM to run in test models.
Will update MAXEVAL
, NITER
, and NBURN
, whichever is relevant for each estimation method.
The best number for this is model-dependent. Typically, something between 10 and
100 is good, depending on how long each iteration takes. You want something that
will run for 3-5 minutes total. You can set this argument to NULL
to run with the
same settings as the original model. Any option set to 0
will not be overwritten.
args passed through to submit_models()
A list of the model objects for the submitted models.
Unfortunately, there is no easy way to know how many threads are ideal for a given NONMEM model. It is dependent on many factors, including model complexity and the structure of the input data. Typically, the best way to find the ideal number of threads for a given model is to test it empirically. This function is intended to help the user do this.
The function will create copies of your model, cap the number of evaluation iterations, and then
run these copies with the specified number of threads. The check_run_times()
helper can then
be used to easily see how long each test model ran for, giving you a good sense of what the ideal
number of threads might be.
if (FALSE) {
mod <- read_model(file.path(MODEL_DIR, 1))
mods <- test_threads(.mod = mod, .threads = c(2, 4), .cap_iterations = 10,
.mode = "local")
check_run_times(mods, .wait = TRUE, .time_limit = 100)
check_run_times(mods, .wait = FALSE, .return_times = "all")
delete_models(.mods = mods)
# Dry Run:
mods <- test_threads(.mod = mod, .threads = c(2, 4), .cap_iterations = 10,
.mode = "local", .dry_run = TRUE)
delete_models(.mods = mods)
}