qiskit/releasenotes/notes/0.17/paralle-config-options-97c1...

37 lines
2.1 KiB
YAML

---
features:
- |
The user config file has 2 new configuration options, ``num_processes`` and
``parallel``, which are used to control the default behavior of
:func:`~qiskit.tools.parallel_map`. The ``parallel`` option is a boolean
that is used to dictate whether :func:`~qiskit.tools.parallel_map` will
run in multiple processes or not. If it set to ``False`` calls to
:func:`~qiskit.tools.parallel_map` will be executed serially, while setting
it to ``True`` will enable parallel execution. The ``num_processes`` option
takes an integer which sets how many CPUs to use when executing in parallel.
By default it will use the number of CPU cores on a system.
- |
There are 2 new environment variables, ``QISKIT_PARALLEL`` and
``QISKIT_NUM_PROCS``, that can be used to control the default behavior of
:func:`~qiskit.tools.parallel_map`. The ``QISKIT_PARALLEL`` option can be
set to the ``TRUE`` (any capitalization) to set the default to run in
multiple processes when :func:`~qiskit.tools.parallel_map` is called. If it
is set to any other
value :func:`~qiskit.tools.parallel_map` will be executed serially.
``QISKIT_NUM_PROCS`` takes an integer (for example ``QISKIT_NUM_PROCS=5``)
which will be used as the default number of processes to run with. Both
of these will take precedence over the equivalent option set in the user
config file.
upgrade:
- |
By default on macOS with Python >=3.8 :func:`~qiskit.tools.parallel_map`
will no longer run in multiple processes. This is a change from previous
releases where the default behavior was that
:func:`~qiskit.tools.parallel_map` would launch multiple processes. This
change was made because with newer versions of macOS with Python 3.8 and
3.9 multiprocessing is either unreliable or adds significant overhead
because of the change in Python 3.8 to launch new processes with ``spawn``
instead of ``fork``. To re-enable parallel execution on macOS with
Python >= 3.8 you can use the user config file ``parallel`` option or set
the environment variable ``QISKIT_PARALLEL`` to ``True``.