Skip to main contentIBM 

Qiskit C API enables new end-to-end quantum + HPC workflows

Qiskit SDK v2.2 delivers a key ingredient needed to realize end-to-end quantum-centric supercomputing workflows as a single application written natively in popular HPC programming languages like C++. Explore this capability today with our new HPC workflow demo.

This year, we introduced Qiskit’s first compiled language interface, the Qiskit C API. This interface will be essential for realizing the full potential of quantum-centric supercomputing (QCSC), an emerging framework we believe will enable the first demonstrations of quantum advantage by the end of 2026. However, progress has been gradual, and Qiskit developers have lacked the ability to build a full end-to-end quantum + HPC workflow using only compiled languages as enabled by the C API—until now.

The C API in Qiskit v2.0 gave users the ability to build and interact with observables, and Qiskit v2.1 added support for building and manipulating circuits. Now, the new Qiskit SDK v2.2 release adds a dedicated transpiler function for transpilation of quantum circuits. With these components, you can build fully functioning quantum-centric supercomputing applications covering all four steps of a typical quantum computing workflow—mapping, optimization, execution of quantum circuits, and post-processing on classical HPC infrastructure. Your application can be written in any of the compiled languages that are used natively in classical high-performance computing (HPC) environments.

Explore and test these capabilities today with the new quantum + HPC workflow demo. The demo provides step-by-step instructions and working code for running a real QCSC workflow based on the sample-based quantum diagonalization (SQD) algorithm, a promising candidate for near-term demonstrations of quantum advantage.

Explore the Qiskit C API demo on GitHub.

C API enables hybrid workflows in C++

Eagle-eyed developers will quickly notice that, although the demo is based on Qiskit’s C API, its code is written in C++. One of the key benefits of the C API is that C offers extensive interoperability with other programming languages, making it possible to build wrappers for other compiled languages like C++ and Fortran, arguably the two most widely used programming languages in modern HPC environments.

C API_L.png

This detailed workflow diagram shows how the new C API demo provides an implementation of a complete SQD workflow as a single application. The workflow includes data preparation, build/transpilation/execution of circuits for quantum sampling, and parallel execution of classical post-processing on HPC infrastructure using MPI—corresponding to the four steps of Qiskit patterns (https://quantum.cloud.ibm.com/docs/en/guides/intro-to-patterns), a general framework for understanding and constructing quantum workflows.

The new C API demo provides an HPC-ready implementation of an SQD workflow which leverages OpenMP and MPI (Message Passing Interface), the standardized frameworks for parallel computing in HPC environments. It brings together capabilities enabled by other recent projects including the SBD (selected basis diagonalization) eigensolver built by RIKEN, the national research laboratory in Japan, Qiskit C++, QRMI (Quantum Resource Management Interface), the qiskit-ibm-runtime C client, and a brand new HPC-oriented version of Qiskit’s SQD addon—also built in C++. Altogether, these capabilities allow you to compile an SQD workflow that uses MPI in a way that is native for a broad cross-section of HPC environments.

We plan to maintain each of the Qiskit components mentioned above for the foreseeable future. However, keep in mind that the demo repository itself is just a proof of concept. It has only been tested with OpenMPI and we do not expect to maintain it over the long term.

Ultimately, our work developing the quantum-centric supercomputing workflows of the future is just getting started. This demo takes us one step closer to bringing quantum computation to long-standing HPC codebases and projects written in compiled languages like C++ or Fortran—for example, by making SQD available as a subroutine to existing quantum chemistry programs. That could be a game-changer for researchers and developers who don’t have experience writing QCSC programs from scratch, and who would instead prefer to use chemistry software with which they’re already familiar.

A new HPC-system-ready SQD addon in C++

One key component of the Qiskit C API demo is the new HPC-ready SQD addon, which takes the key capabilities of the original Python-based SQD addon, and recreates them in a compiled language that is more suitable to run on a high-performance computing (HPC) system alongside an eigensolver that uses MPI to diagonalize large subspaces. The new tool recreates the original SQD addon in the form of a C++17 template library, which is designed to be compatible with the standard library interfaces that are used in modern C++.

C++17 is a major version of the C++ standard that was released in December 2017. The Qiskit developers behind the new SQD addon chose it over the more recent C++20 standard because it is relatively modern while also being old enough that the vast majority of modern compilers are likely to support it.

Specifically, because it is written in a compiled language like C++, users can leverage the new SQD addon to compile their parallel QCSC application into a single binary executable. This executable can be used with mpiexec or mpirun, standardized commands for launching parallel jobs across the multiple processors and nodes that make up modern HPC environments, and is designed for scalable execution on HPC clusters.

Explore the new HPC-ready SQD addon qiskit-addon-sqd-hpc on GitHub.

The HPC-ready SQD addon offers a number of additional features to make it convenient for users. It is designed to work well across several platforms, with continuous integration testing on Linux and macOS for the x86_64 and ARMv8 instruction set architectures, as well as testing on Windows for x86_64. It can work in restricted coding environments, including those where exceptions and run-time type information (RTTI) are disabled to get every last bit of performance. It is highly performant, with a micro-benchmark suite that can be run on a machine of your choice. And, like its Python counterpart, it contains complete API documentation.

Note that, in our SQD workflow, only the classical eigensolver is orchestrated by MPI, and quantum integration takes place exclusively at rank 0. Be sure to check the GitHub project linked above for more details on these features.

Running the C API demo

The new C API demo shows you how to post-process noisy quantum samples to approximate the ground state energy of Fe₄S₄, a cluster of four iron (Fe) and four sulfide (S) ions that is found in many proteins and enzymes that perform important cellular processes in biological organisms. The GitHub project offers detailed instructions to get you started, but we’ll share some of the code here to give you a sense of how it works.

Before you begin, you’ll need to install Rust v1.85 or higher, a C compiler with support for C++17, CMake and Make—available as RPM packages on most RHEL-compatible operating systems—and Python v3.11 or higher. You’ll also need to install the OpenBLAS, OpenMPI, and Eigen3 libraries in your environment, and you’ll need to initialize several submodules before building, including qiskit, qiskit-cpp, qrmi, sbd, qiskit-addon-sqd-hpc, and boost/dynamic_bitset, by running git submodule update --init --recursive.

Once you’re ready to recreate the demo for yourself, you’ll start by building the Qiskit C extension:

cd deps/qiskit make c

You’ll build the QRMI service to enable access to quantum hardware from the Qiskit C++ sampler interface:

cd deps/qrmi cargo build --release

And you’ll build your demo from the project root:

mkdir -p build cd build cmake .. make

To run simulations on IBM Quantum® hardware via QRMI, you’ll set the following environment variables using credentials from your IBM Quantum account:

export QISKIT_IBM_TOKEN="your API key" export QISKIT_IBM_INSTANCE="your CRN"

Running a single process will look like the below. The amount of HPC resources required for this demo will depend on the --number_of_samples parameter, because this determines the dimension of the subspace:

./c-api-demo \ --fcidump ../data/fcidump_Fe4S4_MO.txt \ -v \ --tolerance 1.0e-3 \ --max_time 600 \ --recovery 1 \ --number_of_samples 300 \ --num_shots 1000 \ --backend_name <your backend name>

And running an MPI execution will look like the below. As a reminder for quantum users who may not be as familiar with HPC workflows, mpirun is a command for launching parallel jobs across multiple nodes in an HPC cluster:

mpirun -np 96 ./c-api-demo \ --fcidump ../data/fcidump_Fe4S4_MO.txt \ -v \ --tolerance 1.0e-3 \ --max_time 600 \ --recovery 1 \ --number_of_samples 2000 \ --num_shots 10000 \ --backend_name <your backend name>

To test this out, we can choose ibm_kingston as our backend and run the code shown above. Here's the output we get in return:

2025-10-07 01:09:22: initial parameters are loaded. param_length=2632 QRMI connecting : ibm_kingston QRMI Job submitted to ibm_kingston, JOB ID = d3i6gha0uq0c73d7l9u0 {"results": [{"data": {"c": {"samples": ["0x42ed07eba40fde6758", ...]}}}]} 2025-10-07 01:09:44: start recovery: iteration=0 2025-10-07 01:09:44: Number of recovered bitstrings: 1000 2025-10-07 01:09:44: number of items in a batch: 300 2025-10-07 01:09:44: number of items in left ci_strs:599 2025-10-07 01:09:44: number of items in right ci_strs:599 2025-10-07 01:09:44: number of unique ci_strs:599 Davidson iteration 0.0 (tol=0.0227339): -326.524 Davidson iteration 0.1 (tol=0.0031872): -326.525 -325.839 Davidson iteration 0.2 (tol=0.000494147): -326.525 -325.862 -325.447 Elapsed time for diagonalization 1.33511 (sec) Energy = -326.5250125594463 2025-10-07 01:09:46: energy: -326.525013

The C API demo gives you numerous command-line options for controlling the behavior of the SQD simulation and quantum sampling. In terms of the SQD algorithm, you can control things like the number of configuration recovery iterations and the number of samples per batch. In terms of the SBD eigensolver, you can control elements like the maximum number of Davidson iterations, the maximum size of the Ritz vector space, the number of nodes used to split the alpha- and beta-determinants, and more.

Be sure to check the project README file for a full list of options.

Get started today

We hope you’ll give the new C API demo a try and begin thinking about how you may be able to take inspiration from it in your own research. We also encourage you to contribute to the demo or any of the projects it integrates, including Qiskit C++, the SBD eigensolver developed by RIKEN, QRMI, or the work-in-progress qiskit-ibm-runtime-c library, which aims to provide a C API to the IBM Quantum service for Qiskit C API users.

This is an extremely exciting time in quantum computing. Open-source projects like these and the cutting-edge algorithm development being conducted by IBM® and its partners are moving us rapidly toward the era of quantum advantage, and the developers who contribute to these efforts today could very well play a role in making that long-sought milestone a reality.


Quantum starts here(opens in a new tab)