Skip to content

Parallelism

Using Rust's rayon crate, particle routines can run in parallel. The number of threads to be used can be adjusted with the set_num_threads function.

By default, Rust will use all the available threads. If this results in the device being unresponsive, consider lowering the max thread number. The device's number of available threads can be found with get_max_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)

dexter.get_max_threads() -> int

Returns the number of the device's available threads.