Learn R Programming

umx (version 1.9.1)

umx_set_cores: umx_set_cores

Description

set the number of cores (threads) used by OpenMx

Usage

umx_set_cores(cores = NA, model = NULL, silent = FALSE)

Arguments

cores

number of cores to use. NA (the default) returns current value. "-1" will set to detectCores().

model

an (optional) model to set. If left NULL, the global option is updated.

silent

If TRUE, no message will be printed.

Value

- number of cores

References

- http://tbates.github.io, https://github.com/tbates/umx

See Also

Other Get and set: umx_get_checkpoint, umx_set_auto_plot, umx_set_auto_run, umx_set_checkpoint, umx_set_condensed_slots, umx_set_optimizer, umx_set_plot_file_suffix, umx_set_plot_format, umx_set_table_format

Examples

Run this code
# NOT RUN {
library(umx)
manifests = c("mpg", "disp", "gear")
m1 <- mxModel("ind", type = "RAM",
	manifestVars = manifests,
	mxPath(from = manifests, arrows = 2),
	mxPath(from = "one", to = manifests),
	mxData(mtcars[, manifests], type = "raw")
)
umx_set_cores() # print current value
oldCores <- umx_set_cores(silent = TRUE)  # store existing value
umx_set_cores(parallel::detectCores()) # set to max
umx_set_cores(-1); umx_set_cores() # set to max
m1 = umx_set_cores(1, m1)  # set m1 useage to 1 core
umx_set_cores(model = m1)  # show new value for m1
umx_set_cores(oldCores)    # reinstate old global value
# }

Run the code above in your browser using DataLab