Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.13.1 #1983

Merged
merged 17 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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* *musllinux*"
CIBW_SKIP: "*-manylinux_i686 pp* cp36* cp37* cp312* *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* *musllinux*"
CIBW_SKIP: "*-manylinux_i686 pp* cp36* cp37* cp312* *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
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ jobs:
- name: Install Aer
run: |
set -e
python -I -m build --wheel --config-setting=--build-option=-- --config-setting=--build-option=-DTEST_JSON=1
pip install --find-links=dist qiskit-aer
python -I -m build --wheel --config-setting=--build-option=-DTEST_JSON=1
pip install -U dist/*.whl
- name: Run Tests
run: |
set -e
Expand Down Expand Up @@ -267,7 +267,7 @@ jobs:
run: |
set -e
python -I -m build --wheel
pip install --find-links=dist qiskit-aer
pip install -U dist/*.whl
shell: bash
- name: Run Tests
env:
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
author = 'Qiskit Development Team'

# The short X.Y version
version = '0.13.0'
version = '0.13.1'
# The full version, including alpha/beta/rc tags
release = '0.13.0'
release = '0.13.1'

templates_path = ['_templates']

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.0
0.13.1
4 changes: 3 additions & 1 deletion qiskit_aer/backends/aer_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ def compile(self, circuits, basis_gates=None, optypes=None):
circuit = self._inline_initialize(circuit, compiled_optypes[idx])
if self._is_dynamic(circuit, compiled_optypes[idx]):
compiled_circ = transpile(
self._inline_circuit(circuit, None, None), basis_gates=basis_gates
self._inline_circuit(circuit, None, None),
basis_gates=basis_gates,
optimization_level=0,
)
compiled_circuits.append(compiled_circ)
# Recompute optype for compiled circuit
Expand Down
35 changes: 31 additions & 4 deletions qiskit_aer/backends/aer_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,8 @@ class AerSimulator(AerBackend):
"while_loop",
"break_loop",
"continue_loop",
"reset",
"switch_case",
]
),
"density_matrix": sorted(
Expand All @@ -538,6 +540,8 @@ class AerSimulator(AerBackend):
"while_loop",
"break_loop",
"continue_loop",
"reset",
"switch_case",
]
),
"matrix_product_state": sorted(
Expand All @@ -562,6 +566,8 @@ class AerSimulator(AerBackend):
"while_loop",
"break_loop",
"continue_loop",
"reset",
"switch_case",
]
),
"stabilizer": sorted(
Expand All @@ -583,6 +589,8 @@ class AerSimulator(AerBackend):
"while_loop",
"break_loop",
"continue_loop",
"reset",
"switch_case",
]
),
"extended_stabilizer": sorted(
Expand All @@ -591,13 +599,15 @@ class AerSimulator(AerBackend):
"qerror_loc",
"roerror",
"save_statevector",
"reset",
]
),
"unitary": sorted(
[
"save_state",
"save_unitary",
"set_unitary",
"reset",
]
),
"superop": sorted(
Expand All @@ -609,6 +619,7 @@ class AerSimulator(AerBackend):
"save_state",
"save_superop",
"set_superop",
"reset",
]
),
"tensor_network": sorted(
Expand All @@ -630,6 +641,8 @@ class AerSimulator(AerBackend):
"save_statevector_dict",
"set_statevector",
"set_density_matrix",
"reset",
"switch_case",
]
),
}
Expand Down Expand Up @@ -682,7 +695,9 @@ class AerSimulator(AerBackend):

_AVAILABLE_DEVICES = None

def __init__(self, configuration=None, properties=None, provider=None, **backend_options):
def __init__(
self, configuration=None, properties=None, provider=None, target=None, **backend_options
):
self._controller = aer_controller_execute()

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

super().__init__(
configuration, properties=properties, provider=provider, backend_options=backend_options
configuration,
properties=properties,
provider=provider,
target=target,
backend_options=backend_options,
)

@classmethod
Expand Down Expand Up @@ -799,6 +818,11 @@ def _name(self):
def from_backend(cls, backend, **options):
"""Initialize simulator from backend."""
if isinstance(backend, BackendV2):
if backend.description is None:
description = "created by AerSimulator.from_backend"
else:
description = backend.description

configuration = QasmBackendConfiguration(
backend_name=f"'aer_simulator({backend.name})",
backend_version=backend.backend_version,
Expand All @@ -813,9 +837,10 @@ def from_backend(cls, backend, **options):
max_shots=int(1e6),
coupling_map=list(backend.coupling_map.get_edges()),
max_experiments=backend.max_circuits,
description=backend.description,
description=description,
)
properties = target_to_backend_properties(backend.target)
target = backend.target
elif isinstance(backend, BackendV1):
# Get configuration and properties from backend
configuration = copy.copy(backend.configuration())
Expand All @@ -824,6 +849,8 @@ def from_backend(cls, backend, **options):
# Customize configuration name
name = configuration.backend_name
configuration.backend_name = f"aer_simulator({name})"

target = None
else:
raise TypeError(
"The backend argument requires a BackendV2 or BackendV1 object, "
Expand All @@ -840,7 +867,7 @@ def from_backend(cls, backend, **options):
options["noise_model"] = noise_model

# Initialize simulator
sim = cls(configuration=configuration, properties=properties, **options)
sim = cls(configuration=configuration, properties=properties, target=target, **options)
return sim

def available_methods(self):
Expand Down
54 changes: 21 additions & 33 deletions qiskit_aer/backends/aerbackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from qiskit.pulse import Schedule, ScheduleBlock
from qiskit.qobj import QasmQobj, PulseQobj
from qiskit.result import Result
from qiskit.transpiler import CouplingMap
from ..aererror import AerError
from ..jobs import AerJob, AerJobSet, split_qobj
from ..noise.noise_model import NoiseModel, QuantumErrorLocation
Expand All @@ -48,7 +49,7 @@ class AerBackend(Backend, ABC):
"""Aer Backend class."""

def __init__(
self, configuration, properties=None, defaults=None, backend_options=None, provider=None
self, configuration, properties=None, provider=None, target=None, backend_options=None
):
"""Aer class for backends.

Expand All @@ -59,8 +60,8 @@ def __init__(
Args:
configuration (BackendConfiguration): backend configuration.
properties (BackendProperties or None): Optional, backend properties.
defaults (PulseDefaults or None): Optional, backend pulse defaults.
provider (Provider): Optional, provider responsible for this backend.
target (Target): initial target for backend
backend_options (dict or None): Optional set custom backend options.

Raises:
Expand All @@ -76,22 +77,24 @@ def __init__(
backend_version=configuration.backend_version,
)

# Initialize backend properties and pulse defaults.
# Initialize backend properties
self._properties = properties
self._defaults = defaults
self._configuration = configuration

# Custom option values for config, properties, and defaults
# Custom option values for config, properties
self._options_configuration = {}
self._options_defaults = {}
self._options_properties = {}
self._target = None
self._target = target
self._mapping = NAME_MAPPING

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

# build coupling map
if self.configuration().coupling_map is not None:
self._coupling_map = CouplingMap(self.configuration().coupling_map)

def _convert_circuit_binds(self, circuit, binds, idx_map):
parameterizations = []

Expand Down Expand Up @@ -330,18 +333,6 @@ def properties(self):
setattr(properties, key, val)
return properties

def defaults(self):
"""Return the simulator backend pulse defaults.

Returns:
PulseDefaults: The backend pulse defaults or ``None`` if the
backend does not support pulse.
"""
defaults = copy.copy(self._defaults)
for key, val in self._options_defaults.items():
setattr(defaults, key, val)
return defaults

@property
def max_circuits(self):
if hasattr(self.configuration(), "max_experiments"):
Expand All @@ -351,17 +342,16 @@ def max_circuits(self):

@property
def target(self):
self._target = convert_to_target(
self.configuration(), self.properties(), self.defaults(), self._mapping
)
return self._target
if self._target is not None:
return self._target

return convert_to_target(self.configuration(), self.properties(), None, NAME_MAPPING)

def clear_options(self):
"""Reset the simulator options to default values."""
self._options = self._default_options()
self._options_configuration = {}
self._options_properties = {}
self._options_defaults = {}

def status(self):
"""Return backend status.
Expand Down Expand Up @@ -702,8 +692,6 @@ def set_option(self, key, value):
self._set_configuration_option(key, value)
elif hasattr(self._properties, key):
self._set_properties_option(key, value)
elif hasattr(self._defaults, key):
self._set_defaults_option(key, value)
else:
if not hasattr(self._options, key):
raise AerError(f"Invalid option {key}")
Expand Down Expand Up @@ -735,15 +723,15 @@ def _set_properties_option(self, key, value):
elif key in self._options_properties:
self._options_properties.pop(key)

def _set_defaults_option(self, key, value):
"""Special handling for setting backend defaults options."""
if value is not None:
self._options_defaults[key] = value
elif key in self._options_defaults:
self._options_defaults.pop(key)

def __repr__(self):
"""String representation of an AerBackend."""
name = self.__class__.__name__
display = f"'{self.name}'"
return f"{name}({display})"

def get_translation_stage_plugin(self):
"""use custom translation method to avoid gate exchange"""
if self._target is None:
return "aer_backend_plugin"
else:
return None
Loading
Loading