A Hybrid Classical-Quantum HPC Workload: Aniello Esposito, Jessica R. Jones, Sebastien Cabaniols and David Brayford
A Hybrid Classical-Quantum HPC Workload: Aniello Esposito, Jessica R. Jones, Sebastien Cabaniols and David Brayford
A Hybrid Classical-Quantum HPC Workload: Aniello Esposito, Jessica R. Jones, Sebastien Cabaniols and David Brayford
Abstract—A strategy for the orchestration of hybrid classical- that those challenges can be addressed, a hybrid classical-
quantum workloads on supercomputers featuring quantum de- quantum system can be thought of as broadly similar to any
vices is proposed. The method makes use of heterogeneous job
arXiv:2312.04933v1 [quant-ph] 8 Dec 2023
the quantum device, as well as the circuit transfer time, remain Listing 1. job2 waits while job1 uses the quantum resource
negligible, the conditions under which this hybrid workload
can eventually outperform its purely classical counterpart are In Listing 1, job1 has been allocated the quantum resource,
given. qnode1 and, the two HPC machines are waiting for the end
of the quantum computation. job2 is waiting on resources
D. Anatomy of an Improved Hybrid Workload because the quantum machine, qnode1 is busy.
The MPMD model used in Sec. II-B is simple, but it blocks JOBID PARTITION NAME USER ST TIME NODES NODELIST(REASON)
a quantum device for the whole duration of the classical 105754+1 Q job1 seb CG 0:31 1 qnode1
105756+1 Q job2 seb PD 0:00 1 (Resources)
application and so potentially wastes precious resources. A 105756+0 HPC job2 seb PD 0:00 2 (Resources)
reduction of this idle time can be achieved by using the Slurm 105754+0 HPC job1 seb R 0:33 2 hpcn[136-137]
support for heterogeneous jobs (hetjobs) to split a job Listing 2. The quantum part of job1 is completing.
across differing hardware. A simple scenario consists of two
heterogeneous jobs {job1,job2} , each requiring classical In Listing 2, the quantum part of job1 is done; the quantum
and quantum computing resources. As is typical in HPC, the resource is being liberated, while the classical part of job1
is still running. Meanwhile, job2 is still pending as it waits
0 python hhl_demo.py
for the resources it needs to become available. 1 python circuit_simulator.py
Listing 4. Classical part of job1 is still computing, while job2 is running #SBATCH -N2
#SBATCH -C classic
#SBATCH -p HPC
Listing 4 shows job1 is continuing its classical computation. #SBATCH --exclusive
job2 is now running, with the quantum computation in #SBATCH hetjob
#SBATCH -N1
progress and the classical computation eventually waiting for #SBATCH -C quantum
the results (blocking MPI call). #SBATCH -p Q
#SBATCH -w qnode1
#SBATCH --exclusive
III. C ONCLUSION
srun -n2 --ntasks-per-node=1 python hhl_demo.py : -n1 --
A hybrid classical-quantum workload for the repeated so- ntasks-per-node=1 python circuit_simulator.py
lution of a system of linear equations has been executed on
Listing 7. hetjob.sh, the main job script
a single HPE Cray EX system within the MPMD model of
Slurm. The circuits are generated by a classical scientific appli-
cation and then evaluated by a simulator imitating a quantum ACKNOWLEDGEMENTS
device. Synthesis of a circuit is ideally done locally and not
remotely, which is really an administrative or legal (licensing) The authors would like to thank Alfio Lazzaro for proof
issue, rather than a technical one. The lower precision of reading and helpful comments, Frédéric Ciesielski and Yann
the results from a quantum device needs to be taken into Maupu for their Slurm expertise and testbed, and also the
account and improved by either using more qubits and an team at Classiq for allowing the authors access to their
improved algorithm, or by classical techniques such as iterative professional tool suite and for continuous support during our
refinement for this particular use case. Extraction of the full collaboration. Thanks also are due to the reviewers, whose
state vector has to be avoided if possible. For the more flexible comments helped guide improvements to this work.
case, where a quantum resource does not have to be bound to
a classical application until its termination in an MPMD job, a R EFERENCES
strategy using heterogeneous jobs in Slurm has been presented,
where the quantum device can be freed up during the job run- [1] A. Montanaro, “Quantum algorithms: an overview,” npj Quantum Infor-
time, and used by the next heterogeneous job. In the next mation, vol. 2, no. 1, pp. 1–8, 2016.
[2] J. H. Davenport, J. R. Jones, and M. Thomason, “A practical overview
step the use case will be executed as a heterogeneous job to of quantum computing: Is exascale possible?” 2023.
profile the framework and eventually, the circuit simulator will [3] “Slurm workload manager,” https://slurm.schedmd.com/. [Online].
be replaced by an actual quantum device. Available: https://slurm.schedmd.com/
[4] Message Passing Interface Forum, MPI: A Message-Passing Interface
Standard Version 4.0, Jun 2021. [Online]. Available: https://www.
A PPENDIX mpi-forum.org/docs/mpi-4.0/mpi40-report.pdf
[5] T. Hoefler, T. Häner, and M. Troyer, “Disentangling hype
Listing 5 shows the MPMD Slurm job script for the example from practicality: On realistically achieving quantum advantage,”
in Sec. II-B Communications of the ACM, vol. 66, no. 5, p. 82–87, apr 2023.
[Online]. Available: https://doi.org/10.1145/3571725
#!/bin/bash [6] A. W. Harrow, A. Hassidim, and S. Lloyd, “Quantum algorithm for
linear systems of equations,” Physical review letters, vol. 103, no. 15,
#SBATCH -N 1
#SBATCH -t 10 p. 150502, 2009.
#SBATCH --exclusive [7] “Classiq: Create quantum computing software without limits,” https:
//www.classiq.io/. [Online]. Available: https://www.classiq.io/
srun -n 2 -c 1 -u -l --multi-prog multi.conf [8] L. S. Bishop, “Qasm 2.0: A quantum circuit intermediate representation,”
in APS March Meeting Abstracts, vol. 2017, 2017, pp. P46–008.
Listing 5. Slurm MPMD job script [9] L. Dalcin and Y.-L. L. Fang, “mpi4py: Status update after 12 years of
development,” Computing in Science & Engineering, vol. 23, no. 4, pp.
with the configuration file 47–54, 2021.
[10] C. Haine, U.-U. Haus, M. Martinasso, D. Pleiter, F. Tessier, D. Sar-
many, S. Smart, T. Quintino, and A. Tate, “A middleware supporting
data movement in complex and software-defined storage and memory
architectures,” in High Performance Computing: ISC High Performance
Digital 2021 International Workshops, Frankfurt am Main, Germany,
June 24–July 2, 2021, Revised Selected Papers 36. Springer, 2021, pp.
346–357.
[11] J. Doi and H. Horii, “Cache blocking technique to large scale quantum
computing simulation on supercomputers,” in 2020 IEEE International
Conference on Quantum Computing and Engineering (QCE). IEEE,
2020, pp. 212–222.
[12] C. R. Harris, K. J. Millman, S. J. van der Walt, R. Gommers,
P. Virtanen, D. Cournapeau, E. Wieser, J. Taylor, S. Berg, N. J.
Smith, R. Kern, M. Picus, S. Hoyer, M. H. van Kerkwijk, M. Brett,
A. Haldane, J. F. del Rı́o, M. Wiebe, P. Peterson, P. Gérard-Marchant,
K. Sheppard, T. Reddy, W. Weckesser, H. Abbasi, C. Gohlke,
and T. E. Oliphant, “Array programming with NumPy,” Nature,
vol. 585, no. 7825, pp. 357–362, Sep 2020. [Online]. Available:
https://doi.org/10.1038/s41586-020-2649-2