Notebook execution
The kernel is able to execute only one cell. All the code including imports should be in a single cell:
from qiskit import QuantumCircuit, transpile
from qiskit_aer import Aer, AerSimulator, AerError
import os
def demo_function(shotsAmount=1000):
simulator = AerSimulator(method='statevector', device='GPU')
circuit = QuantumCircuit(2, 2)
circuit.h(0)
circuit.cx(0, 1)
circuit.measure([0, 1], [0, 1])
compiled_circuit = transpile(circuit, simulator)
job = simulator.run(compiled_circuit, shots=shotsAmount)
result = job.result()
counts = result.get_counts()
print("Total count for 00 and 11 are:", counts)
print(circuit)
return counts
result = demo_function(2000)
Notebook magic commands are not supported:
%pip install qiskit
Dependencies
The default container image used to run the circuits in the cluster is currently hardcoded with the following dependencies:
qiskit==1.0.0
qiskit-aer-gpu==0.13.3
qiskit_algorithms
qiskit_ibm_runtime
numpy
networkx
You can chnage the dependencies by creating a custom image and using it in the Jupyter container.