Main Content

Parallel for-Loops (parfor)

Use parallel processing by running parfor on workers in a parallel pool

Parallel Computing Toolbox™ supports interactive parallel computing and enables you to accelerate your workflow by running on multiple workers in a parallel pool. Use parfor to execute for-loop iterations in parallel on workers in a parallel pool. When you have profiled your code and identified slow for-loops, try parfor to increase your throughput. Develop parfor-loops on your desktop and scale up to a cluster without changing your code.

Functions

expand all

parforExecute for-loop iterations in parallel on workers
parforOptionsOptions set for parfor (Since R2019a)
parpoolCreate parallel pool on cluster
parfevalRun function on parallel pool worker
ticBytesStart counting bytes transferred within parallel pool
tocBytesRead how many bytes have been transferred since calling ticBytes
sendSend data from worker to client using a data queue
afterEachDefine a function to call when new data is received on a DataQueue
parallel.PoolParallel pool of workers
parallel.pool.DataQueueSend and listen for data between client and workers

Topics

Getting Started with parfor

Running parfor-Loops

Deep Learning