mindspore.dataset.config.set_multiprocessing_start_method

View Source On Gitee
mindspore.dataset.config.set_multiprocessing_start_method(start_method='fork')

Set a global configuration to indicate how to start a subprocess for data preprocessing. This setting will affect the way of starting subprocess in GeneratorDataset, map and batch operations.

Parameters

start_method (str, optional) – multiprocessing start method in the data preprocessing phase. Default: 'fork' . Optional values: ['fork', 'spawn'].

Raises
  • TypeError – If start_method is not of type str.

  • ValueError – If start_method is neither fork nor spawn .

Examples

>>> # Set a new global configuration value for multiprocessing start method.
>>> import mindspore.dataset as ds
>>> ds.config.set_multiprocessing_start_method("fork")