mindspore.dataset.config.set_num_parallel_workers

mindspore.dataset.config.set_num_parallel_workers(num)

Set a new global configuration default value for the number of parallel workers. This setting will affect the parallelism of all dataset operation.

Parameters

num (int) – Number of parallel workers to be used as a default for each operation.

Raises
  • TypeError – If num is not of type int.

  • ValueError – If num <= 0 or num > INT32_MAX(2147483647).

Examples

>>> # Set a new global configuration value for the number of parallel workers.
>>> # Now parallel dataset operations will run with 8 workers.
>>> ds.config.set_num_parallel_workers(8)