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 function
detectCores()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.