ThreadPool - Parallel pool of thread workers on the local machine - MATLAB (original) (raw)
Main Content
Parallel pool of thread workers on the local machine
Since R2020a
Description
Use parpool
to create a parallel pool of thread workers on your local machine. After you create the pool, parallel pool features, such asparfor
or parfeval
, run on the workers. With theThreadPool
object, you can interact with the parallel pool.
Creation
Create a parallel pool of thread workers on the local machine by using the parpool function.
pool = parpool('Threads')
Properties
Busy
— Flag that indicates whether the thread pool is busy
true | false
This property is read-only.
Flag that indicates whether the thread pool is busy, specified astrue
or false
. The pool is busy if there is outstanding work for the pool to complete.
FevalQueue
— Queue of FevalFuture
objects to run on the thread pool
FevalQueue
This property is read-only.
Queue of FevalFuture
objects to run on the thread pool, returned as a FevalQueue
object. You can use this property to check the pending and running future variables of the parallel pool. To create future variables, useparfeval and parfevalOnAll. For more information on future variables, see Future.
Data Types: FevalQueue
FileStore
— Store of files accessible to both client and workers
FileStore
Store of files accessible to both client and workers, specified as a FileStore object.
NumWorkers
— Number of thread workers comprising the parallel pool
integer
This property is read-only.
Number of thread workers comprising the parallel pool, specified as an integer. You can specify the number of thread workers during pool creation with parpool.
ValueStore
— Store of data accessible to both client and workers
ValueStore
Store of data accessible to both client and workers, specified as a ValueStore object.
Object Functions
delete | Shut down parallel pool |
---|---|
parfeval | Run function on parallel pool worker |
parfevalOnAll | Run function asynchronously on all workers in parallel pool |
Limitations
- Pools created using
parpool('Threads')
and backgroundPool are both thread-based pools which utilize the same resources. It is possible that activity on one pool may block activity on the other and vice versa. Additionally, persistent data and random number generation stream state are shared in between these pools. For more information on controlling random number streams, see Control Random Number Streams on Workers. - Not all functionality is supported in a thread-based environment. For details on specific limitations, see Check Thread Supported Functions.
Version History
Introduced in R2020a