RFC: Managing thread-level parallelism
Posted on

Forums
Starting in OpenMx 1.2, we will have support for multicore execution of the FIML objective function, and for the numerical calculation of the Hessian that is used to compute standard error estimates. A mechanism is needed to specify the number of threads to be assigned to the computations.
We currently have an option available under ?mxOption() that is named "Number of Cores". I'd like to rename the option to "Number of Threads" if there are no objections. And I'd like to propose the following behavior for the value (N) that is stored in this option.
- If N < 0, then throw an error.
- If N > 0, then use N threads.
- If N = 0 and we are not executing a dependent model, then call the function
omxDetectCores()
to determine the number of threads.omxDetectCores()
is backport of the functiondetectCores()
introduced in R 2.14.0. - If N = 0 and we are executing an independent model, then use 1 thread.
- The default value for "Number of Threads" is 0.
As you see, some trickery is used to make sure that processors are allocated correctly when independent submodels are executed. The default is to allocate 1 thread per independent submodel, unless the user explicitly provides a positive integer for the "Number of Threads" option.
Very cool! What mechanism is
Log in or register to post comments
In reply to Very cool! What mechanism is by JWiley
We're using OpenMP for the
Log in or register to post comments
In reply to We're using OpenMP for the by mspiegel
Thanks for the info! Makes
dat <- list(A = 1:5, B = matrix(1:4, 2), N = 2L)
dat["N"] <- list(NULL)
Log in or register to post comments
no objection here
Log in or register to post comments