start - Start collecting parallel pool activity monitoring data - MATLAB (original) (raw)
Main Content
Start collecting parallel pool activity monitoring data
Since R2025a
Syntax
Description
start([monitor](#mw%5Fd005d035-b382-477d-b42e-53dfc168706a))
starts collecting pool activity monitoring data using the ActivityMonitor object, monitor
.
Use the start
function to restart monitoring pool activity with an ActivityMonitor
object that has previously stopped monitoring activity.
If monitor
is already monitoring pool activity, the software discards any results collected.
Examples
Create a parallel pool using the cluster profile, myCluster
.
pool = parpool("myCluster",4);
Starting parallel pool (parpool) using the 'myCluster' profile ... Connected to parallel pool with 4 workers.
Create an ActivityMonitor
object to collect monitoring data for the pool but do not start collecting data immediately.
monitor = parallel.pool.ActivityMonitor(pool,Start=false);
Create some large data on the client, then build a Constant
object, C
, transferring the data to the pool only once.
data = rand(1000); C = parallel.pool.Constant(data);
Start collecting pool monitoring data using the ActivityMonitor
object, monitor
.
Run multiple parfor
-loops accessing the Constant
object, C
. For efficiency, preallocate the results array.
x = eye(5); for ii = 1:5 parfor jj = 1:5 x(ii,jj) = C.Value(ii,jj); end end
Stop the activity monitor and retrieve the monitoring results collected during the execution of the parfor
-loops.
monitoringResults = stop(monitor);
Create an ActivityMonitor
object to start collecting pool monitoring data. With default settings, parallel.pool.ActivityMonitor
automatically starts an interactive parallel pool using the default profile if one does not exist.
monitor = parallel.pool.ActivityMonitor;
Starting parallel pool (parpool) using the 'Processes' profile ... Connected to parallel pool with 6 workers.
Submit multiple parfeval
computations to compute magic squares. Wait for all tasks to complete.
f(1:100) = parallel.Future; for idx = 1:100 f(idx) = parfeval(@magic,1,idx); end wait(f);
Use the stop
function to stop collecting monitoring data and retrieve the monitoring results.
monitoringResults = stop(monitor);
To restart collecting monitoring data, use the start
function.
Input Arguments
Pool activity monitor, specified as an ActivityMonitor
object.
Example: monitor = parallel.pool.ActivityMonitor
Version History
Introduced in R2025a