Skip to main contentIBM Quantum Documentation
You are viewing the API reference for an old version of Qiskit SDK. Switch to latest version

parallel_map(task, values, task_args=(), task_kwargs={}, num_processes=2)

GitHub(opens in a new tab)

Parallel execution of a mapping of values to the function task. This is functionally equivalent to:

result = [task(value, *task_args, **task_kwargs) for value in values]

On Windows this function defaults to a serial implementation to avoid the overhead from spawning processes in Windows.


  • task (func) – Function that is to be called for each value in values.
  • values (array_like) – List or array of values for which the task function is to be evaluated.
  • task_args (list) – Optional additional arguments to the task function.
  • task_kwargs (dict) – Optional additional keyword argument to the task function.
  • num_processes (int) – Number of processes to spawn.


The result list contains the value of

task(value, *task_args, **task_kwargs) for

each value in values.

Return type



QiskitError – If user interrupts via keyboard.


terra.parallel.start: The collection of parallel tasks are about to start. terra.parallel.update: One of the parallel task has finished. terra.parallel.finish: All the parallel tasks have finished.


import time
from import parallel_map
def func(_):
        return 0
parallel_map(func, list(range(10)));
Was this page helpful?
Report a bug or request content on GitHub.