cf.collapse_parallel_mode

cf.collapse_parallel_mode(*arg)[source]

Which mode to use when collapse is run in parallel. There are three possible modes:

  1. This attempts to maximise parallelism, possibly at the expense of extra communication. This is the default mode.

  2. This minimises communication, possibly at the expense of the degree of parallelism. If collapse is running slower than you would expect, you can try changing to mode 1 to see if this improves performance. This is only likely to work if the output of collapse will be a sizeable array, not a single point.

  3. This is here for debugging purposes, but we would expect this to maximise communication possibly at the expense of parallelism. The use of this mode is, therefore, not recommended.

Parameters
arg: int or Constant, optional

The new value (0, 1 or 2).

Returns
Constant

The value prior to the change, or the current value if no new value was specified.

Examples

>>> cf.collapse_parallel_mode()
0
>>> cf.collapse_parallel_mode(1)
0
>>> cf.collapse_parallel_mode()
1