Multiprocessing for simulator devices

Hi there,
I’m working on a quantum variational classifier. In almost every learning strategy, the cost function is essentially a sum over the training dataset of some function involving the evaluation of the circuit. It’s clear that each evaluation is independent. I was wondering if it is possible to exploit the multiprocessing feature of python to parallelize the evaluation of the cost function for large datasets, at least in simulations.

1 Like

Hi @Davide_Nicotra,

One approach within PennyLane could be to evaluate multiple QNodes, potentially in parallel. Once done, these group of results can be used to evaluate the cost function.

When using hardware simulators like the QVM from PennyLane-Forest, we’ve noticed that asynchronous evaluation using Dask has speed advantages for multiple QNode evaluations (see Asynchronous evaluation section of QNodeCollection). For state vector simulators, unfortunately, this advantage was not observed so clearly.

Apart from that, we are also adding new features to compute QNodes in batches. The PennyLane-Braket and PennyLane-Orquestra plugins, for example, include computing jacobians in batches remotely.

Allowing further use cases for the batched execution of quantum circuits is on our radar.