Skip to content

Commit

Permalink
Release 0.13.2 (#2031)
Browse files Browse the repository at this point in the history
* PR to release 0.13.2

* Remove usage of ``qiskit.extensions`` (#2023)

The module has been pending deprecation since Qiskit 0.45.
It is deprecated for 0.46 and removed in 1.0.

This removal concerns the import location of ``UnitaryGate`` and the
usage of the ``ExtensionError``. The first is easily fixed, whereas for
the latter I tried using ``ValueError`` or ``TypeError``, which seemed
to cover the error meanings. Technically, this is a breaking change and
we could introduce an intermediary class that inherits from the deprecated
``ExtensionError`` and the new choice of error. However, since we will
soon be changing to 1.0 and we also skipped this in Qiskit Terra (as we
thought it highly unlikely that users are actually relying on this error
type) it might be fine to just change the error type.

* Fix GPU batched execution (#2014)

* Fix GPU batched execution

* format

* Use Apple-specific API to determine system memory on macOS (#2016)

The unistd.h API that had been used for both Linux and macOS is not
always available in macOS environments, for example when building with
upstream clang rather than AppleClang.

Closes #1923

* Remove qiskit.test from test/common.py (#1971)

* remove qiskit.test from test/common.py

* fix format, add releasenote

---------

Co-authored-by: Hiroshi Horii <hhorii@users.noreply.github.com>

* raise Qiskit dependency to 0.45.0 (#2008)

Co-authored-by: Hiroshi Horii <hhorii@users.noreply.github.com>

* `deprecate_func(..., since=...)`  should be a string, not a float (#2006)

* deprecate_func "since" parameter should be a str, not a float

* black

* Avoid accessing GPUs when using CPU only (#2012)

* avoid accessing GPUs when using CPU only

* remove unused import/parameter

* Reduce warning meesages (#2013)

* reduce warning meesages

* format

* fix Windows

* uint -> uint_t

* fix Thrust seg fault

* format

* Add support for running with Python 3.12 (#2022)

* Add support for running with Python 3.12

Python 3.12.0 was released on 10-02-2023, this commit marks the start
of support for Python 3.12 in qiskit-aer. It adds the supported Python
version in the package metadata and updates the CI configuration to run
test jobs on Python 3.12 and build Python 3.12 wheels on release.

* Remove numpy constraints

* Uncap six

* Fix i686 build steps

* Use python 3.12.0 in tests to work around unittest breakage in 3.12.1

* Use 3.12.0 for all test jobs

---------

Co-authored-by: Jun Doi <doichan@jp.ibm.com>

* enable bit operations for boolean types (#2024)

Co-authored-by: Jun Doi <doichan@jp.ibm.com>

---------

Co-authored-by: Julien Gacon <gaconju@gmail.com>
Co-authored-by: Will Shanks <willshanks@us.ibm.com>
Co-authored-by: Hiroshi Horii <hhorii@users.noreply.github.com>
Co-authored-by: Luciano Bello <bel@zurich.ibm.com>
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
  • Loading branch information
6 people committed Jan 17, 2024
1 parent ea4f277 commit 5c33837
Show file tree
Hide file tree
Showing 96 changed files with 1,317 additions and 1,076 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ jobs:
uses: microsoft/setup-msbuild@v1.0.2
if: runner.os == 'Windows'
- name: Install deps
run: python -m pip install -U cibuildwheel==2.11.2
run: python -m pip install -U cibuildwheel==2.16.2
- name: Build Wheels
env:
AER_CMAKE_OPENMP_BUILD: 1
Expand All @@ -152,7 +152,7 @@ jobs:
with:
python-version: 3.8
- name: Install deps
run: python -m pip install -U cibuildwheel==2.11.2
run: python -m pip install -U cibuildwheel==2.16.2
- name: Build Wheels
env:
CIBW_ARCHS_MACOS: arm64
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ jobs:
env:
CIBW_BEFORE_ALL: "yum install -y yum-utils wget && wget -q https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda-repo-rhel7-11-8-local-11.8.0_520.61.05-1.x86_64.rpm && rpm -i cuda-repo-rhel7-11-8-local-11.8.0_520.61.05-1.x86_64.rpm && yum clean all && yum -y install cuda && yum -y install openblas-devel && yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo && yum clean all"
CIBW_BEFORE_BUILD : "pip install nvidia-cuda-runtime-cu11 nvidia-cublas-cu11 nvidia-cusolver-cu11 nvidia-cusparse-cu11 cuquantum-cu11"
CIBW_SKIP: "*-manylinux_i686 pp* cp36* cp37* cp312* *musllinux*"
CIBW_SKIP: "*-manylinux_i686 pp* cp36* cp37* *musllinux*"
CIBW_ENVIRONMENT: QISKIT_AER_PACKAGE_NAME=qiskit-aer-gpu-cu11 QISKIT_AER_CUDA_MAJOR=11 CMAKE_VERBOSE_MAKEFILE=true AER_THRUST_BACKEND=CUDA CUDACXX=/usr/local/cuda/bin/nvcc AER_CUDA_ARCH="7.0 7.2 7.5 8.0 8.6 8.7" AER_PYTHON_CUDA_ROOT=/opt/_internal AER_CIBUILD=true
CIBW_REPAIR_WHEEL_COMMAND: 'auditwheel repair --exclude libcudart.so.11.0 --exclude libcustatevec.so.1 --exclude libcutensornet.so.2 --exclude libcutensor.so.1 --exclude libcutensorMg.so.1 --exclude libcusolver.so.11 --exclude libcusolverMg.so.11 --exclude libcusparse.so.11 --exclude libcublas.so.11 --exclude libcublasLt.so.11 -w {dest_dir} {wheel}'
run: |
Expand Down Expand Up @@ -192,7 +192,7 @@ jobs:
env:
CIBW_BEFORE_ALL: "yum install -y yum-utils wget && wget -q https://developer.download.nvidia.com/compute/cuda/12.2.2/local_installers/cuda-repo-rhel7-12-2-local-12.2.2_535.104.05-1.x86_64.rpm && rpm -i cuda-repo-rhel7-12-2-local-12.2.2_535.104.05-1.x86_64.rpm && yum clean all && yum -y install nvidia-driver-latest-dkms && yum -y install cuda && yum -y install openblas-devel && yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo && yum clean all"
CIBW_BEFORE_BUILD : "pip install nvidia-cuda-runtime-cu12 nvidia-nvjitlink-cu12 nvidia-cublas-cu12 nvidia-cusolver-cu12 nvidia-cusparse-cu12 cuquantum-cu12"
CIBW_SKIP: "*-manylinux_i686 pp* cp36* cp37* cp312* *musllinux*"
CIBW_SKIP: "*-manylinux_i686 pp* cp36* cp37* *musllinux*"
CIBW_ENVIRONMENT: QISKIT_AER_PACKAGE_NAME=qiskit-aer-gpu QISKIT_AER_CUDA_MAJOR=12 CMAKE_VERBOSE_MAKEFILE=true AER_THRUST_BACKEND=CUDA CUDACXX=/usr/local/cuda/bin/nvcc AER_CUDA_ARCH="7.0 7.2 7.5 8.0 8.6 8.7 9.0" AER_PYTHON_CUDA_ROOT=/opt/_internal AER_CIBUILD=true
CIBW_REPAIR_WHEEL_COMMAND: 'auditwheel repair --exclude libcudart.so.12 --exclude libcustatevec.so.1 --exclude libcutensornet.so.2 --exclude libcutensor.so.1 --exclude libcutensorMg.so.1 --exclude libcusolver.so.11 --exclude libcusolverMg.so.11 --exclude libcusolver.so.12 --exclude libcusolverMg.so.12 --exclude libcusparse.so.12 --exclude libcublas.so.12 --exclude libcublasLt.so.12 --exclude libnvJitLink.so.12 -w {dest_dir} {wheel}'
run: |
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/docs-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ jobs:
python -m pip install --upgrade pip
pip install -U virtualenv setuptools wheel tox
sudo apt-get install graphviz pandoc build-essential libopenblas-dev
- name: Build and publish
- name: Build docs
env:
encrypted_rclone_key: ${{ secrets.encrypted_rclone_key }}
encrypted_rclone_iv: ${{ secrets.encrypted_rclone_iv }}
QISKIT_DOCS_BUILD_TUTORIALS: 'always'
run: |
tools/deploy_documentation.sh
run: tox -edocs
- name: Bypass Jekyll Processing # Necessary for setting the correct css path
run: touch docs/_build/html/.nojekyll
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: docs/_build/html/
9 changes: 4 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
needs: ["lint"]
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", '3.11']
python-version: [3.8, 3.9, "3.10", '3.11', "3.12.0"]
platform: [
{ os: "ubuntu-latest", python-architecture: "x64" },
]
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
timeout-minutes: 60
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", "3.11"]
python-version: [3.8, 3.9, "3.10", "3.11", "3.12.0"]
os: ["ubuntu-latest"]
env:
AER_THRUST_BACKEND: OMP
Expand Down Expand Up @@ -190,7 +190,7 @@ jobs:
timeout-minutes: 60
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", '3.11']
python-version: [3.8, 3.9, "3.10", '3.11', "3.12.0"]
os: ["macOS-latest"]
env:
AER_THRUST_BACKEND: OMP
Expand Down Expand Up @@ -233,7 +233,7 @@ jobs:
timeout-minutes: 60
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", "3.11"]
python-version: [3.8, 3.9, "3.10", "3.11", "3.12.0"]
os: ["windows-2019"]
env:
AER_THRUST_BACKEND: OMP
Expand Down Expand Up @@ -280,4 +280,3 @@ jobs:
rm -rf qiskit_aer
stestr run --slowest
shell: bash

3 changes: 0 additions & 3 deletions constraints.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
pylint==2.4.4
astroid==2.3.3
six>1.10,<=1.14
numpy>=1.16.3,<1.25
scipy>=1.0

# Jinja2 3.1.0 is incompatible with sphinx and/or jupyter until they are updated
# to work with the new jinja version (the jinja maintainers aren't going to
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ build-backend = "setuptools.build_meta"
[tool.cibuildwheel]
manylinux-x86_64-image = "manylinux2014"
manylinux-i686-image = "manylinux2014"
skip = "pp* cp36* cp37* cp312* *musllinux*"
test-skip = "cp310-win32 cp310-manylinux_i686 cp311-win32 cp311-manylinux_i686"
skip = "pp* cp36* cp37* *musllinux*"
test-skip = "cp310-win32 cp310-manylinux_i686 cp311-win32 cp311-manylinux_i686 cp312-win32 cp312-manylinux_i686"
test-command = "python {project}/tools/verify_wheels.py"
# We need to use pre-built versions of Numpy and Scipy in the tests; they have a
# tendency to crash if they're installed from source by `pip install`, and since
Expand All @@ -30,7 +30,7 @@ before-all = "yum install -y openblas-devel"
environment = { CMAKE_GENERATOR = "Visual Studio 16 2019"}

[[tool.cibuildwheel.overrides]]
select = "cp3{8,9,10,11}-manylinux_i686"
select = "cp3{8,9,10,11,12}-manylinux_i686"
before-all = "yum install -y wget && bash {project}/tools/install_openblas_i686.sh && bash {project}/tools/install_rust.sh"

[tool.black]
Expand Down
2 changes: 1 addition & 1 deletion qiskit_aer/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.13.1
0.13.2
2 changes: 1 addition & 1 deletion qiskit_aer/backends/aer_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from qiskit.circuit import QuantumCircuit, Clbit, ClassicalRegister, ParameterExpression
from qiskit.circuit.classical.expr import Expr, Unary, Binary, Var, Value, ExprVisitor, iter_vars
from qiskit.circuit.classical.types import Bool, Uint
from qiskit.extensions import Initialize
from qiskit.circuit.library import Initialize
from qiskit.providers.options import Options
from qiskit.pulse import Schedule, ScheduleBlock
from qiskit.circuit.controlflow import (
Expand Down
6 changes: 2 additions & 4 deletions qiskit_aer/backends/aer_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,12 +702,10 @@ def __init__(

# Update available methods and devices for class
if AerSimulator._AVAILABLE_DEVICES is None:
AerSimulator._AVAILABLE_DEVICES = available_devices(
self._controller, AerSimulator._SIMULATION_DEVICES
)
AerSimulator._AVAILABLE_DEVICES = available_devices(self._controller)
if AerSimulator._AVAILABLE_METHODS is None:
AerSimulator._AVAILABLE_METHODS = available_methods(
self._controller, AerSimulator._SIMULATION_METHODS, AerSimulator._AVAILABLE_DEVICES
AerSimulator._SIMULATION_METHODS, AerSimulator._AVAILABLE_DEVICES
)

# Default configuration
Expand Down
42 changes: 12 additions & 30 deletions qiskit_aer/backends/backend_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import psutil
from qiskit.circuit import QuantumCircuit
from qiskit.compiler import assemble
from qiskit.qobj import QasmQobjInstruction
from qiskit.result import ProbDistribution
from qiskit.quantum_info import Clifford
Expand Down Expand Up @@ -441,40 +440,23 @@ def cpp_execute_circuits(controller, aer_circuits, noise_model, config):
return controller.execute(aer_circuits, noise_model, config)


def available_methods(controller, methods, devices):
"""Check available simulation methods by running a dummy circuit."""
# Test methods are available using the controller
dummy_circ = QuantumCircuit(1)
dummy_circ.id(0)
def available_methods(methods, devices):
"""Check available simulation methods"""

valid_methods = []
for device in devices:
for method in methods:
if method not in valid_methods:
qobj = assemble(
dummy_circ, optimization_level=0, shots=1, method=method, device=device
)
result = cpp_execute_qobj(controller, qobj)
if result.get("success", False):
valid_methods.append(method)
for method in methods:
if method == "tensor_network":
if "GPU" in devices:
valid_methods.append(method)
else:
valid_methods.append(method)
return tuple(valid_methods)


def available_devices(controller, devices):
"""Check available simulation devices by running a dummy circuit."""
# Test methods are available using the controller
dummy_circ = QuantumCircuit(1)
dummy_circ.id(0)

valid_devices = []
for device in devices:
qobj = assemble(
dummy_circ, optimization_level=0, shots=1, method="statevector", device=device
)
result = cpp_execute_qobj(controller, qobj)
if result.get("success", False):
valid_devices.append(device)
return tuple(valid_devices)
def available_devices(controller):
"""return available simulation devices"""
dev = controller.available_devices()
return tuple(dev)


def add_final_save_instruction(qobj, state):
Expand Down
4 changes: 2 additions & 2 deletions qiskit_aer/backends/name_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
CRZGate,
MCU1Gate,
MCXGrayCode,
Initialize,
UCGate,
)
from qiskit.circuit.controlflow import (
IfElseOp,
Expand All @@ -43,8 +45,6 @@
BreakLoopOp,
SwitchCaseOp,
)
from qiskit.extensions import Initialize
from qiskit.extensions.quantum_initializer import UCGate
from qiskit.quantum_info.operators.channel.kraus import Kraus
from qiskit.quantum_info.operators.channel import SuperOp
from qiskit.quantum_info.operators.channel.quantum_channel import QuantumChannel
Expand Down
1 change: 0 additions & 1 deletion qiskit_aer/backends/qasm_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,6 @@ def __init__(self, configuration=None, properties=None, provider=None, **backend
# Update available methods for class
if QasmSimulator._AVAILABLE_METHODS is None:
QasmSimulator._AVAILABLE_METHODS = available_methods(
self._controller,
QasmSimulator._SIMULATION_METHODS,
QasmSimulator._SIMULATION_DEVICES,
)
Expand Down
4 changes: 1 addition & 3 deletions qiskit_aer/backends/statevector_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,7 @@ def __init__(self, configuration=None, properties=None, provider=None, **backend
self._controller = aer_controller_execute()

if StatevectorSimulator._AVAILABLE_DEVICES is None:
StatevectorSimulator._AVAILABLE_DEVICES = available_devices(
self._controller, StatevectorSimulator._SIMULATION_DEVICES
)
StatevectorSimulator._AVAILABLE_DEVICES = available_devices(self._controller)

if configuration is None:
configuration = QasmBackendConfiguration.from_dict(
Expand Down
4 changes: 1 addition & 3 deletions qiskit_aer/backends/unitary_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,7 @@ def __init__(self, configuration=None, properties=None, provider=None, **backend
self._controller = aer_controller_execute()

if UnitarySimulator._AVAILABLE_DEVICES is None:
UnitarySimulator._AVAILABLE_DEVICES = available_devices(
self._controller, UnitarySimulator._SIMULATION_DEVICES
)
UnitarySimulator._AVAILABLE_DEVICES = available_devices(self._controller)

if configuration is None:
configuration = QasmBackendConfiguration.from_dict(
Expand Down
2 changes: 1 addition & 1 deletion qiskit_aer/backends/wrappers/aer_circuit_binding.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ void bind_aer_circuit(MODULE m) {
<< ", num_registers=" << circ.num_registers;

ss << ", ops={";
for (auto i = 0; i < circ.ops.size(); ++i)
for (uint_t i = 0; i < circ.ops.size(); ++i)
if (i == 0)
ss << circ.ops[i];
else
Expand Down
10 changes: 10 additions & 0 deletions qiskit_aer/backends/wrappers/aer_controller_binding.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ class ControllerExecutor {
return AerToPy::to_python(
controller_execute<T>(circuits, noise_model, config));
}

py::object available_devices() {
T controller;
return AerToPy::to_python(controller.available_devices());
}
};

template <typename T>
Expand Down Expand Up @@ -100,6 +105,11 @@ void bind_aer_controller(MODULE m) {
return self.execute(circuits, noise_model_native, config);
});

aer_ctrl.def("available_devices",
[aer_ctrl](ControllerExecutor<Controller> &self) {
return self.available_devices();
});

py::class_<Config> aer_config(m, "AerConfig");
aer_config.def(py::init());
aer_config.def_readwrite("shots", &Config::shots);
Expand Down
10 changes: 5 additions & 5 deletions qiskit_aer/backends/wrappers/aer_state_binding.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ void bind_aer_state(MODULE m) {
size_t mat_len = (1UL << qubits.size());
auto ptr = values.unchecked<2>();
cmatrix_t mat(mat_len, mat_len);
for (auto i = 0; i < mat_len; ++i)
for (auto j = 0; j < mat_len; ++j)
for (uint_t i = 0; i < mat_len; ++i)
for (uint_t j = 0; j < mat_len; ++j)
mat(i, j) = ptr(i, j);
state.apply_unitary(qubits, mat);
});
Expand All @@ -144,10 +144,10 @@ void bind_aer_state(MODULE m) {
size_t mat_size = (1UL << control_qubits.size());
auto ptr = values.unchecked<3>();
std::vector<cmatrix_t> mats;
for (auto i = 0; i < mat_size; ++i) {
for (uint_t i = 0; i < mat_size; ++i) {
cmatrix_t mat(mat_len, mat_len);
for (auto j = 0; j < mat_len; ++j)
for (auto k = 0; k < mat_len; ++k)
for (uint_t j = 0; j < mat_len; ++j)
for (uint_t k = 0; k < mat_len; ++k)
mat(j, k) = ptr(i, j, k);
mats.push_back(mat);
}
Expand Down
7 changes: 3 additions & 4 deletions qiskit_aer/library/default_qubits.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"""

from qiskit.circuit import QuantumRegister
from qiskit.extensions.exceptions import ExtensionError


def default_qubits(circuit, qubits=None):
Expand All @@ -27,7 +26,7 @@ def default_qubits(circuit, qubits=None):
[Default: None]
Raises:
ExtensionError: if default qubits fails.
ValueError: if default qubits fails.
Returns:
list: qubits list.
Expand All @@ -37,9 +36,9 @@ def default_qubits(circuit, qubits=None):
# This is needed for full register snapshots like statevector
if isinstance(qubits, QuantumRegister):
qubits = qubits[:]
if not qubits:
if qubits is None:
qubits = list(circuit.qubits)
if len(qubits) == 0:
raise ExtensionError("no qubits for snapshot")
raise ValueError("no qubits for snapshot")

return qubits

0 comments on commit 5c33837

Please sign in to comment.