Using the real-time chip simulator in new QAT

The RTCS is available with QAT pipelines, however it is just the legacy version of it wrapped so fit the pipeline API. See below for how it can be used to easily execute programs.

Let’s start by writing a simple program that we’d like to execute.

from compiler_config.config import CompilerConfig, QuantumResultsFormat

config = CompilerConfig(results_format=QuantumResultsFormat().binary_count())
qasm = """
OPENQASM 2.0;
include "qelib1.inc";
qreg q[2];
creg c[2];
h q[0];
cx q[0], q[1];
measure q -> c;
"""

Now we can create a RTCS simulator pipeline and execute the program.

from qat import QAT
from qat.model.loaders.purr.rtcs import RTCSModelLoader
from qat.pipelines.legacy.rtcs import LegacyRTCSPipeline

loader = RTCSModelLoader()
pipeline = LegacyRTCSPipeline(config=dict(name="rtcs"), loader=loader)

results, metrics = QAT().run(qasm, pipeline=pipeline, compiler_config=config)
print(results)
{'c': {'11': 481, '00': 376, '01': 74, '10': 69}}