Skip to content

Commit ea4f277

Browse files
doichanjikkohamElePTnotjoncruzhhorii
authored
Release 0.13.1 (#1983)
* add skip Python 3.12 for GPU build (#1965) * Fix basis gates of Aer backends (#1976) * move reset and switch_case ops to custom istr * Fix reset in AerStatevector * add test case * format * fix installing built Aer in some test cases * Applying global phase multiplication to initialize operation (#1980) * Applying global phase to initialize operation * fix format * remove recursive, add omp * Release 0.13.1 * Revert too many deprecations in Estimator (#1990) * Revert too much deprecation * fix typo * fix tests * Change priority of method selection of noise simulation (#1989) * Avoid selecting stabilizer method when noise model contains rotational gates * remove checking noise opsets, change priority selecting density_matrix * format * modify test cases use auto method result may change by this PR * modify one more test case * Remove use of opflow in Estimator (#1996) * Update misspelling apply_gate method doc (#1998) Co-authored-by: Jun Doi <doichan@jp.ibm.com> * Add optimization_level=0 to transpiler for compiling dynamic circuits (#2000) ``id`` gate was removed by transpiler called from aer_compiler without optimization_level for dynamic circuits. This commits adds ``optimization_level=0`` to avoid removing id gates * fix ry gate for stabilizer (#2001) Co-authored-by: Hiroshi Horii <hhorii@users.noreply.github.com> * Directly use psutil to get total system memory (#2002) Currently Aer is using Qiskit's local_hardware_info() function which to determine the total amount of system memory which is used to compute the largest statevector the system can build. However, this function wasn't really intended to be used outside of Qiskit and also Qiskit is looking to remove the memory reporting (see: Qiskit/qiskit#11254). This commit just pivots to using psutil directly which is what qiskit is doing internally. * test build fix (#2004) * Reverse ordering to read out error in sampling measure (#2003) * reverse ordering of read out error in sampling measure * fix batch check --------- Co-authored-by: Hiroshi Horii <hhorii@users.noreply.github.com> * Fix extended stabilizer thread safety in apply_ops_parallel (#1993) * Extended stabilizer simulator no longer shares RngEngine amongst states when ops are applied in parallel * Added release note * Fixed ugly cast --------- Co-authored-by: Jun Doi <doichan@jp.ibm.com> * add note (#1992) Co-authored-by: Jun Doi <doichan@jp.ibm.com> * Fix AerBackend issues caused by upgrading BackendV2 (#1995) * add description if no description is provided, build coupling map if it is provided * move import line * fix target for simulator backend * format * remove unused import * use translation plugin to rebuild gate sets for simulator * rename plugin * rebuild of gate sets is eanbled only for opt level 0 and 1 * fix custom pass manager * fix pass_manager function * added ccx in NAME_MAPPING * added missed gates in NAME_MAPPING * added release note * add check if opnodes is None * add check config * decrease return * check opt level * fix searching ops in control flow blocks * Update qiskit_aer/backends/plugin/aer_backend_plugin.py Co-authored-by: Matthew Treinish <mtreinish@kortar.org> * Update qiskit_aer/backends/plugin/aer_backend_plugin.py Co-authored-by: Matthew Treinish <mtreinish@kortar.org> * refer review comments * remove unused import --------- Co-authored-by: Matthew Treinish <mtreinish@kortar.org> * add prelude --------- Co-authored-by: Ikko Hamamura <ikkoham@users.noreply.github.com> Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com> Co-authored-by: jon <70080228+notcruz@users.noreply.github.com> Co-authored-by: Hiroshi Horii <hhorii@users.noreply.github.com> Co-authored-by: Matthew Treinish <mtreinish@kortar.org> Co-authored-by: eliotheinrich <38039898+eliotheinrich@users.noreply.github.com>
1 parent 2478a5b commit ea4f277

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+521
-192
lines changed

.github/workflows/deploy.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ jobs:
148148
env:
149149
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"
150150
CIBW_BEFORE_BUILD : "pip install nvidia-cuda-runtime-cu11 nvidia-cublas-cu11 nvidia-cusolver-cu11 nvidia-cusparse-cu11 cuquantum-cu11"
151-
CIBW_SKIP: "*-manylinux_i686 pp* cp36* cp37* *musllinux*"
151+
CIBW_SKIP: "*-manylinux_i686 pp* cp36* cp37* cp312* *musllinux*"
152152
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
153153
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}'
154154
run: |
@@ -192,7 +192,7 @@ jobs:
192192
env:
193193
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"
194194
CIBW_BEFORE_BUILD : "pip install nvidia-cuda-runtime-cu12 nvidia-nvjitlink-cu12 nvidia-cublas-cu12 nvidia-cusolver-cu12 nvidia-cusparse-cu12 cuquantum-cu12"
195-
CIBW_SKIP: "*-manylinux_i686 pp* cp36* cp37* *musllinux*"
195+
CIBW_SKIP: "*-manylinux_i686 pp* cp36* cp37* cp312* *musllinux*"
196196
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
197197
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}'
198198
run: |

.github/workflows/tests.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ jobs:
175175
- name: Install Aer
176176
run: |
177177
set -e
178-
python -I -m build --wheel --config-setting=--build-option=-- --config-setting=--build-option=-DTEST_JSON=1
179-
pip install --find-links=dist qiskit-aer
178+
python -I -m build --wheel --config-setting=--build-option=-DTEST_JSON=1
179+
pip install -U dist/*.whl
180180
- name: Run Tests
181181
run: |
182182
set -e
@@ -267,7 +267,7 @@ jobs:
267267
run: |
268268
set -e
269269
python -I -m build --wheel
270-
pip install --find-links=dist qiskit-aer
270+
pip install -U dist/*.whl
271271
shell: bash
272272
- name: Run Tests
273273
env:

docs/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@
4545
author = 'Qiskit Development Team'
4646

4747
# The short X.Y version
48-
version = '0.13.0'
48+
version = '0.13.1'
4949
# The full version, including alpha/beta/rc tags
50-
release = '0.13.0'
50+
release = '0.13.1'
5151

5252
templates_path = ['_templates']
5353

qiskit_aer/VERSION.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.13.0
1+
0.13.1

qiskit_aer/backends/aer_compiler.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ def compile(self, circuits, basis_gates=None, optypes=None):
9999
circuit = self._inline_initialize(circuit, compiled_optypes[idx])
100100
if self._is_dynamic(circuit, compiled_optypes[idx]):
101101
compiled_circ = transpile(
102-
self._inline_circuit(circuit, None, None), basis_gates=basis_gates
102+
self._inline_circuit(circuit, None, None),
103+
basis_gates=basis_gates,
104+
optimization_level=0,
103105
)
104106
compiled_circuits.append(compiled_circ)
105107
# Recompute optype for compiled circuit

qiskit_aer/backends/aer_simulator.py

+31-4
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,8 @@ class AerSimulator(AerBackend):
516516
"while_loop",
517517
"break_loop",
518518
"continue_loop",
519+
"reset",
520+
"switch_case",
519521
]
520522
),
521523
"density_matrix": sorted(
@@ -538,6 +540,8 @@ class AerSimulator(AerBackend):
538540
"while_loop",
539541
"break_loop",
540542
"continue_loop",
543+
"reset",
544+
"switch_case",
541545
]
542546
),
543547
"matrix_product_state": sorted(
@@ -562,6 +566,8 @@ class AerSimulator(AerBackend):
562566
"while_loop",
563567
"break_loop",
564568
"continue_loop",
569+
"reset",
570+
"switch_case",
565571
]
566572
),
567573
"stabilizer": sorted(
@@ -583,6 +589,8 @@ class AerSimulator(AerBackend):
583589
"while_loop",
584590
"break_loop",
585591
"continue_loop",
592+
"reset",
593+
"switch_case",
586594
]
587595
),
588596
"extended_stabilizer": sorted(
@@ -591,13 +599,15 @@ class AerSimulator(AerBackend):
591599
"qerror_loc",
592600
"roerror",
593601
"save_statevector",
602+
"reset",
594603
]
595604
),
596605
"unitary": sorted(
597606
[
598607
"save_state",
599608
"save_unitary",
600609
"set_unitary",
610+
"reset",
601611
]
602612
),
603613
"superop": sorted(
@@ -609,6 +619,7 @@ class AerSimulator(AerBackend):
609619
"save_state",
610620
"save_superop",
611621
"set_superop",
622+
"reset",
612623
]
613624
),
614625
"tensor_network": sorted(
@@ -630,6 +641,8 @@ class AerSimulator(AerBackend):
630641
"save_statevector_dict",
631642
"set_statevector",
632643
"set_density_matrix",
644+
"reset",
645+
"switch_case",
633646
]
634647
),
635648
}
@@ -682,7 +695,9 @@ class AerSimulator(AerBackend):
682695

683696
_AVAILABLE_DEVICES = None
684697

685-
def __init__(self, configuration=None, properties=None, provider=None, **backend_options):
698+
def __init__(
699+
self, configuration=None, properties=None, provider=None, target=None, **backend_options
700+
):
686701
self._controller = aer_controller_execute()
687702

688703
# Update available methods and devices for class
@@ -704,7 +719,11 @@ def __init__(self, configuration=None, properties=None, provider=None, **backend
704719
self._cached_basis_gates = self._BASIS_GATES["automatic"]
705720

706721
super().__init__(
707-
configuration, properties=properties, provider=provider, backend_options=backend_options
722+
configuration,
723+
properties=properties,
724+
provider=provider,
725+
target=target,
726+
backend_options=backend_options,
708727
)
709728

710729
@classmethod
@@ -799,6 +818,11 @@ def _name(self):
799818
def from_backend(cls, backend, **options):
800819
"""Initialize simulator from backend."""
801820
if isinstance(backend, BackendV2):
821+
if backend.description is None:
822+
description = "created by AerSimulator.from_backend"
823+
else:
824+
description = backend.description
825+
802826
configuration = QasmBackendConfiguration(
803827
backend_name=f"'aer_simulator({backend.name})",
804828
backend_version=backend.backend_version,
@@ -813,9 +837,10 @@ def from_backend(cls, backend, **options):
813837
max_shots=int(1e6),
814838
coupling_map=list(backend.coupling_map.get_edges()),
815839
max_experiments=backend.max_circuits,
816-
description=backend.description,
840+
description=description,
817841
)
818842
properties = target_to_backend_properties(backend.target)
843+
target = backend.target
819844
elif isinstance(backend, BackendV1):
820845
# Get configuration and properties from backend
821846
configuration = copy.copy(backend.configuration())
@@ -824,6 +849,8 @@ def from_backend(cls, backend, **options):
824849
# Customize configuration name
825850
name = configuration.backend_name
826851
configuration.backend_name = f"aer_simulator({name})"
852+
853+
target = None
827854
else:
828855
raise TypeError(
829856
"The backend argument requires a BackendV2 or BackendV1 object, "
@@ -840,7 +867,7 @@ def from_backend(cls, backend, **options):
840867
options["noise_model"] = noise_model
841868

842869
# Initialize simulator
843-
sim = cls(configuration=configuration, properties=properties, **options)
870+
sim = cls(configuration=configuration, properties=properties, target=target, **options)
844871
return sim
845872

846873
def available_methods(self):

qiskit_aer/backends/aerbackend.py

+21-33
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from qiskit.pulse import Schedule, ScheduleBlock
3030
from qiskit.qobj import QasmQobj, PulseQobj
3131
from qiskit.result import Result
32+
from qiskit.transpiler import CouplingMap
3233
from ..aererror import AerError
3334
from ..jobs import AerJob, AerJobSet, split_qobj
3435
from ..noise.noise_model import NoiseModel, QuantumErrorLocation
@@ -48,7 +49,7 @@ class AerBackend(Backend, ABC):
4849
"""Aer Backend class."""
4950

5051
def __init__(
51-
self, configuration, properties=None, defaults=None, backend_options=None, provider=None
52+
self, configuration, properties=None, provider=None, target=None, backend_options=None
5253
):
5354
"""Aer class for backends.
5455
@@ -59,8 +60,8 @@ def __init__(
5960
Args:
6061
configuration (BackendConfiguration): backend configuration.
6162
properties (BackendProperties or None): Optional, backend properties.
62-
defaults (PulseDefaults or None): Optional, backend pulse defaults.
6363
provider (Provider): Optional, provider responsible for this backend.
64+
target (Target): initial target for backend
6465
backend_options (dict or None): Optional set custom backend options.
6566
6667
Raises:
@@ -76,22 +77,24 @@ def __init__(
7677
backend_version=configuration.backend_version,
7778
)
7879

79-
# Initialize backend properties and pulse defaults.
80+
# Initialize backend properties
8081
self._properties = properties
81-
self._defaults = defaults
8282
self._configuration = configuration
8383

84-
# Custom option values for config, properties, and defaults
84+
# Custom option values for config, properties
8585
self._options_configuration = {}
86-
self._options_defaults = {}
8786
self._options_properties = {}
88-
self._target = None
87+
self._target = target
8988
self._mapping = NAME_MAPPING
9089

9190
# Set options from backend_options dictionary
9291
if backend_options is not None:
9392
self.set_options(**backend_options)
9493

94+
# build coupling map
95+
if self.configuration().coupling_map is not None:
96+
self._coupling_map = CouplingMap(self.configuration().coupling_map)
97+
9598
def _convert_circuit_binds(self, circuit, binds, idx_map):
9699
parameterizations = []
97100

@@ -330,18 +333,6 @@ def properties(self):
330333
setattr(properties, key, val)
331334
return properties
332335

333-
def defaults(self):
334-
"""Return the simulator backend pulse defaults.
335-
336-
Returns:
337-
PulseDefaults: The backend pulse defaults or ``None`` if the
338-
backend does not support pulse.
339-
"""
340-
defaults = copy.copy(self._defaults)
341-
for key, val in self._options_defaults.items():
342-
setattr(defaults, key, val)
343-
return defaults
344-
345336
@property
346337
def max_circuits(self):
347338
if hasattr(self.configuration(), "max_experiments"):
@@ -351,17 +342,16 @@ def max_circuits(self):
351342

352343
@property
353344
def target(self):
354-
self._target = convert_to_target(
355-
self.configuration(), self.properties(), self.defaults(), self._mapping
356-
)
357-
return self._target
345+
if self._target is not None:
346+
return self._target
347+
348+
return convert_to_target(self.configuration(), self.properties(), None, NAME_MAPPING)
358349

359350
def clear_options(self):
360351
"""Reset the simulator options to default values."""
361352
self._options = self._default_options()
362353
self._options_configuration = {}
363354
self._options_properties = {}
364-
self._options_defaults = {}
365355

366356
def status(self):
367357
"""Return backend status.
@@ -702,8 +692,6 @@ def set_option(self, key, value):
702692
self._set_configuration_option(key, value)
703693
elif hasattr(self._properties, key):
704694
self._set_properties_option(key, value)
705-
elif hasattr(self._defaults, key):
706-
self._set_defaults_option(key, value)
707695
else:
708696
if not hasattr(self._options, key):
709697
raise AerError(f"Invalid option {key}")
@@ -735,15 +723,15 @@ def _set_properties_option(self, key, value):
735723
elif key in self._options_properties:
736724
self._options_properties.pop(key)
737725

738-
def _set_defaults_option(self, key, value):
739-
"""Special handling for setting backend defaults options."""
740-
if value is not None:
741-
self._options_defaults[key] = value
742-
elif key in self._options_defaults:
743-
self._options_defaults.pop(key)
744-
745726
def __repr__(self):
746727
"""String representation of an AerBackend."""
747728
name = self.__class__.__name__
748729
display = f"'{self.name}'"
749730
return f"{name}({display})"
731+
732+
def get_translation_stage_plugin(self):
733+
"""use custom translation method to avoid gate exchange"""
734+
if self._target is None:
735+
return "aer_backend_plugin"
736+
else:
737+
return None

0 commit comments

Comments
 (0)