Skip to content

Parallelism

The Queue type can utilize multiple threads when running particle routines. To set the number of threads use set_num_threads:

dexter.set_num_threads(num: int)

Sets the global number of threads.

Parameters:

  • num (int) –

    The number of threads to use. If num is either $0$ or greater than the device’s number of threads, it defaults to the device’s number of threads.

Example
Configure number of threads
>>> dex.set_num_threads(4)

To get the number of threads available on your system, use get_max_threads:

dexter.get_max_threads() -> int

Returns the number of the device's available threads.