Amp Parallel is a multiprocessing subsystem that requires no extensions. It uses a non-blocking concurrency framework that implements coroutines using PHP generator functions under the hood.

Note: If no worker count is given, the backend will try to auto detect the number of processor cores and set the worker count to that value. Autodetection works on most Windows and *nix-based systems.

Note: The optimal number of workers will depend on the system specifications of the computer. Fewer workers than CPU cores may not achieve full processing potential but more workers than cores can cause excess overhead.


# Param Default Type Description
1 workers Auto int The maximum number of workers i.e. processes to execute in parallel.

Additional Methods#

Return the maximum number of workers:

public workers() : int


use Rubix\ML\Backends\Amp;

$backend = new Amp(); // Autodetect workers

$backend = new Amp(16);