Qiskit 0.42 release notes
0.42.1
Terra 0.23.3
Prelude
Qiskit Terra 0.23.3 is a minor bugfix release.
Bug Fixes
-
Fixes a bug in the
Optimize1qGatesDecompositiontransformation pass where the score for substitutions was wrongly calculated when the gate errors are zero. -
The method
ECRGate.inverse()now returns anotherECRGateinstance rather than a custom gate, since it is self inverse. -
Clip probabilities in the
QuantumState.probabilities()andQuantumState.probabilities_dict()methods to the interval[0, 1]. This fixes roundoff errors where probabilities could e.g. be larger than 1, leading to errors in the shot emulation of the sampler. Fixed #9761. -
Fixed a bug in the
BackendSamplerwhere the binary probability bitstrings were truncated to the minimal number of bits required to represent the largest outcome as integer. That means that if e.g.{"0001": 1.0}was measured, the result was truncated to{"1": 1.0}. -
Fixed an issue with the
PassManagerConfig.from_backend()constructor method when it was used with aBackendV1based simulator backend. For some simulator backends which did not populate some optional fields the constructor would error. Fixed #9265 and #8546 -
Fixed the
BackendSamplerandBackendEstimatorto run successfully with a custombound_pass_manager. Previously, the execution for single circuits with abound_pass_managerwould raise aValueErrorbecause a list was not returned in one of the steps. -
The
GateDirectiontranspiler pass will no longer reject gates that have been given explicit calibrations, but do not exist in the generic coupling map or target. -
Fixed an issue with the
CommutationCheckerclass where it would attempt to internally allocate an array for qubits when it only needed an array to represent qubits. This could cause an excessive amount of memory for wide gates, for example a 4 qubit gate would require 32 gigabytes instead of 2 kilobytes. Fixed #9197 -
Getting empty calibration from
InstructionPropertiesraises AttributeError has been fixed. Now it returnsNone. -
Fixed
qasm()so that it appends;afterresetinstruction. -
Register and parameter names will now be escaped during the OpenQASM 3 export (
qasm3.dumps()) if they are not already valid identifiers. Fixed #9658. -
QPY (using
qpy.load()) will now correctly deserializeStatePreparationinstructions. Previously, QPY would error when attempting to load a file containing one. Fixed #8297. -
Fixed a bug in
random_circuit()with 64 or more qubits andconditional=True, where the resulting circuit could have an incorrectly typed value in its condition, causing a variety of failures during transpilation or other circuit operations. Fixed #9649. -
Fixed an issue with the
OneQubitEulerDecomposerclass’s methodsangles()andangles_and_phase()would error if the input matrix was of a dtype other thancomplex/np.cdouble. In earlier releases this worked fine but this stopped working in Qiskit Terra 0.23.0 when the internals ofOneQubitEulerDecomposerwere re-written in Rust. Fixed #9827 -
The Qiskit gates
CCZGate,CSGate,CSdgGateare not defined inqelib1.incand, therefore, when dump as OpenQASM 2.0, their definition should be inserted in the file. Fixes #9559, #9721, and #9722.
Aer 0.12.0
No change
IBM Q Provider 0.20.2
No change
0.42.0
Terra 0.23.2
No change
Aer 0.12.0
Prelude
The Qiskit Aer 0.12.0 release highlights are:
- Added a new GPU tensor network simulator based on cuTensorNet
- Added a new
AerDensityMatrixclass to theqiskit_aer.quantum_infomodule- Greatly improving the runtime performance of the
AerSimulatorand the legacyQasmSimulator,StatevectorSimulator, andUnitarySimulatorclasses by directly converting the inputQuantumCircuitobjects to an internal C++ representation instead of first serializing the circuit to aQasmQobj. This improvement will be most noticeable for circuits with a small number of qubits or parameterized circuits using theparameter_bindskeyword argument.
New Features
-
Added a new class method
from_backend_properties()to theNoiseModel. This enables constructing a newNoiseModelfrom aBackendPropertiesobject. Similar functionality used to be present in theNoiseModel.from_backend()constructor, however it was removed since aBackendPropertiesobject alone doesn’t contain sufficient information to create aNoiseModelobject. -
Added a new class,
AerDensityMatrix, to theqiskit_aer.quantum_infomodule. This class is used to provide the same interface to the upstreamDensityMatrixclass in Qiskit but backed by Qiskit Aer’s simulation. -
Added a new keyword argument,
abelian_grouping, to theEstimator. This argument is used to control whether theEstimatorwill group the input observables into qubit-wise commutable observables which reduces the number of circuit executions required to compute the expectation value and improves the runtime performance of theEstimator. By default this is set toTrue. -
AerStatehas a new methodinitialize_density_matrix()that sets a density matrix toAER::QV::DensityMatrix. This method will be called inq.i.states.DensityMatrixto initialize its data withndarray.initialize_density_matrix()has a boolean argument that specifies copy or share ofndarraydata. If the data is shared with C++ and python, the data must not be collected in python while C++ accesses it. -
The overhead for running simulations with
run()(for all simulator backend classess) has been greatly reduced. This was accomplished by no longer internally serializingQuantumCircuitobjects intoQasmQobjand instead theQuantumCircuitobject directly to an internal C++ circuit structure used for simulation. This improvement is most noticeable for simulations of circuts with a small number of qubits or parameterized circuits using theparameter_bindskeyword argument ofrun(). Note that pulse simualation (via the now deprecatedPulseSimulator) and DASK-based simulation still use the internal serialization and will not see this performance improvement. -
Added a new method to the
AerJob,circuits(), which returns a list ofQuantumCircuitobjects. This method returnsNoneif Qobj is used for simulation. -
AerStateandAerStatevectornow support applyingKrausoperators. InAerStatevector, one of the Kraus operators is applied randomly to the quantum state based on the error probabilities. -
Added a new simulation method based on NVIDIA’s cuTensorNet APIs of cuQuantum SDK. This provides a GPU accelerated general tensor network simulator that can simulate any quantum circuit, by internally translating the circuit into a tensor network to perform the simulation. To use this simulation method, set
method="tensor_network"anddevice="GPU"when initializing anAerSimulatorobject. For example:from qiskit_aer import AerSimulator tensor_net_sim = AerSimulator(method="tensor_network", device="GPU")This method supports both statevector and density matrix simulations. Noise simulation can also be done with a density matrix single shot simulation if there are not any
SaveStatevectoroperations in the circuit.This new simulation method also supports parallelization with multiple GPUs and MPI processes by using tensor network slicing technique. However, this type of simulation will likely take a very long time if the input circuits are complicated.
-
The
BLA_VENDORenvironment variable can now be specified to use a different BLAS library when building Qiskit Aer from source. By default if this is not specified OpenBLAS will be used by default. If the BLAS library specified in BLA_VENDOR` can not be found then the Cmake build process will stop.
Known Issues
- This release of Qiskit Aer is not compatible with the Conan 2.X release series. If you are building Qiskit Aer from source manually ensure that you are using a Conan 1.x release. Compatibility with newer versions of Conan will be fixed in a future release. You can refer to issue #1730 for more details.
Upgrade Notes
-
The default behavior of the
Estimatorprimitive will now group the input observable into qubit-wise commutable observables. The grouping reduces the number of circuits to be executed and improves the performance. If you desire the previous behavior you can initialize yourEstimatorinstance with the keyword argumentabelian_grouping=False. -
Removed the usage of primitives with the context manager and the initialization with circuits, (observables only for Estimator), and parameters which has been deprecated in the Qiskit Terra 0.22.0 release in October 2022.
-
The behavior of
run()method has changed when invalid or otherwise unsimulatableQuantumCircuitobjects are passed as an input. Previously, in these cases therun()method would return anAerJobwhoseresult()method would return aResultwith theERRORorPARTIAL COMPLETED(depending on whether all the circuit inputs or only some were invalid or not). Starting in this release instead of returning a result object with these statuses an exception will be raised instead. This change was necessary because of the performance improvements by no longer internally serializing theQuantumCircuitobjects to a Qobj before passing it to C++, instead the direct conversion fromQuantumCircuitnow errors directly when trying to simulate a circuit Qiskit Aer is unable to execute. If you desire the previous behavior you can build Qiskit Aer in standalone mode and manually serialize yourQuantumCircuitobjects to a JSON representation of theQasmQobjwhich you then pass to the standalone Aer binary which will retain the previous behavior. -
A deprecated method
add_nonlocal_quantum_error()inNoiseModelhas been removed. No alternative method is available. If you want to add non-local quantum errors, you should write a transpiler pass that inserts your own quantum error into a circuit, and run the pass just before running the circuit on Aer simulator. -
The
NoiseModel.from_backend()now has changed not to acceptBackendPropertiesobject as abackendargument. Use newly addedNoiseModel.from_backend_properties()method instead. -
A deprecated
standard_gatesargument broadly used in several methods and functions (listed below) acrossnoisemodule has been removed.NoiseModel.from_backend()andnoise.device.basic_device_gate_errors()kraus_error(),mixed_unitary_error(),pauli_error()anddepolarizing_error()innoise.errors.standard_errorsQuantumError.__init__()
No alternative means are available because the user should be agnostic about how the simulator represents noises (quantum errors) internally.
-
The constructor of
QuantumErrorhas now dropped the support of deprecated json-like input fornoise_opsargument. Use the new styple input fornoise_opsargument instead, for example,from qiskit.circuit.library import IGate, XGate from qiskit_aer.noise import QuantumError error = QuantumError([ ((IGate(), [1]), 0.9), ((XGate(), [1]), 0.1), ]) # json-like input is no longer accepted (the following code fails) # error = QuantumError([ # ([{"name": "I", "qubits": [1]}], 0.9), # ([{"name": "X", "qubits": [1]}], 0.1), # ])Also it has dropped deprecated arguments:
number_of_qubits: UseQuantumCircuitto definenoise_opsinstead.atol: UseQuantumError.atolattribute instead.standard_gates: No alternative is available (users should not too much care about internal representation of quantum errors).
-
The deprecated
noise.errors.errorutilsmodule has been entirely removed and no alternatives are available. All functions in the module were helper functions meant to be used only for implementing functions instandard_errors(i.e. they should have been provided as private functions) and no longer used in it. -
The deprecated
utils.noise_remapperhave been entirely removed and no alternatives are available since the C++ code now automatically truncates and remaps noise models if it truncates circuits. -
All deprecated functions (
pauli_operators()andreset_operators()) and class (NoiseTransformer) inutils.noise_transformationmodule have been removed, and no alternatives are available. They were in fact private functions/class used only for implementingapproximate_quantum_error()and should not have been public. -
The previously deprecated
qobjargument name of theAerSimulatorandPulseSimulatorclasses’run()method has now been removed. This argument name was deprecated as part of the Qiskit Aer 0.8.0 release and has been by thecircuitsandschedulesargument name respectively. -
Aer’s
setup.pyhas been updated to no longer attempt to make calls topipto install build requirements, both manually and via thesetup_requiresoption insetuptools.setup. The preferred way to build Aer is to use a PEP 517-compatible builder such as:pip install .This change means that a direct call to
setup.pywill no longer work if the build requirements are not installed. This is inline with modern Python packaging guidelines.
Deprecation Notes
-
Support for running Qiskit Aer with Python 3.7 support has been deprecated and will be removed in a future release. This means starting in a future release you will need to upgrade the Python version you’re using to Python 3.8 or above.
-
The
PulseSimulatorbackend has been deprecated and will be removed in a future release. If you’re using thePulseSimulatorbackend to perform pulse level simulation, instead you should use the Qiskit Dynamics library instead to perform the simulation. Qiskit Dynamics provides a more flexible and robust pulse level simulation framework than thePulseSimulatorbackend. -
The
qobj()method of theAerJobclass is now deprecated and will be removed in a future release. The use of the qobj format as input torun()has been deprecated since qiskit-aer 0.9.0 and in most cases this method would returnNonenow anyway. If you’d like to get the input to therun()method now you can use thecircuits()method instead, which will return theQuantumCircuitobjects that were simulated in the job. -
A
warningsargument broadly used in several methods and functions acrossnoisemodule has been deprecated in favor of the use of filtering functions in Python’s standardwarningslibrary.
Bug Fixes
-
Fixed an issue when creating a new
AerStatevectorinstance from anumpy.ndarraythat had non-contiguous memory. Previously, this would result in unexpected behavior (and a potential error) as theAerStatevectorassumed the input array was contiguous. This has been fixed so that memory layout is checked and thenumpy.ndarraywill be copied internally as a contiguous array before using it. -
Fixed an issue with the
Samplerclass where it would previously fail if the inputQuantumCircuitcontained multiple multiple classical registers. Fixed #1679 -
The bits count of classical register used on the GPU was not set before calculating free available memory for chunks that causes infinite loop. So this fix set bits count before allocating chunks if batch shots execution is enabled.
-
Fix build errors and test errors when enabling GPU but disabling cuQuantum.
-
Fixed an issue in the matrix product state simulation method (i.e. setting the keyword argument
method="matrix_product_state"when initializing anAerSimulatorobject) where the simulator would incorrectly sort the qubits prior to performing measurment potentially resulting in an infinite loop. This has been fixed so the measurement of the qubits occurs in the order of the current MPS structure and then sorting afterwards as a post-processing step. This also will likely improve the performance of the simulation method and enable more accurate representation of entangled states. Fixed #1694 -
The
AerSimulatorbackend with methods:statevectordensity_matrixmatrix_product_statestabilizer
now report that they support
break_loopandcontinue_loopinstructions when used as backends for the Terratranspile()function. The simulators already did support these, but had just not been reporting it.
IBM Q Provider 0.20.2
This release removes the overly restrictive version constraints set in the requirements for the package added in 0.20.1. For the 0.20.1 the only dependency that was intended to have a version cap was the requests-ntlm package as its new release was the only dependency which currently has an incompatibility with qiskit-ibmq-provider. The other version caps which were added as part of 0.20.1 were causing installation issues in several environments because it made the qiskit-ibmq-provider package incompatible with the dependency versions used in other packages.