Initevripct
Purpose
Control initialization of PLS_Toolbox on Matlab worker instances in a parpool (Parallel Computing Toolbox). INITEVRIPCT is only relevant if PLS_Toolbox is used with the Mathworks Parallel Computing Toolbox.
Synopsis
- hasgcp = initevripct(timeoutminutes);
Description
INITEVRIPCT is a PLS_Toolbox initialization. It runs a configuration function PREPEVRIIO on each parallel pool Matlab instance, if the Parallel Computing Toolbox (PCT) is installed. The PREPEVRIIO function controls the worker Matlab's access to the matlabprefs.mat file thereby avoiding problems if two workers try to access at the same time.
In order to use PLS_Toolbox code with the Parallel Computing Toolbox you should
- a) Shutdown the parpool if it is already running by:
delete(gcp('nocreate'))
- b) Run initevripct to start the pool and initialize PLS_Toolbox on each parpool Matlab:
initevripct
This will avoid errors when parfor loops (or other parallel usage) using PLS_Toolbox code are first used. Insert a "initevripct" call before such calls to parfor. Once the worker pool has been initialized subsequent calls to initevripct take negligible execution time.
This function should be called before any PCT workers are used to execute PLS_Toolbox code.
Inputs
- timeoutminutes = [{720}] positive integer value used for the parpool's idletimeout setting in minutes. Default = 12 hours.
Outputs
- hasgcp = a boolean indicating whether the PCT parpool is available.