canUseParallelPool

Tells whether a parallel pool can be used.

Category: Programming > Programming Utilities

Syntax

tf = canUseParallelPool

Returns true if parallel features such as parfor can run on a pool, false otherwise.

Description

Use it to decide between a parallel and a serial implementation without triggering an error or starting a pool. The result describes availability only; it does not say whether a pool is currently open.

Output arguments

tf
Logical scalar.

Example

Serial fallback

if canUseParallelPool
    disp('parallel pool available')
else
    disp('running serially')
end
Output
running serially

Notes

MatLivre has no parallel pool, so canUseParallelPool always returns false.

See also

canUseGPU maxNumCompThreads