Skip to content
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ releases may include breaking changes.

- ✨ Use the AWS SDK default credential provider chain when no explicit session
credentials are configured ([#150]) ([**@burgholzer**])
- ✨ Export the stable Amazon Braket device ID and symbol prefix for MQT Core
configuration and runtime packaging ([#147]) ([**@burgholzer**])

### Changed

Expand All @@ -22,6 +24,11 @@ releases may include breaking changes.
retains the existing `BASEURL` mapping ([#149]) ([**@burgholzer**])
- ⬆️ Update QDMI to version 1.3.2 ([#130]) ([**@denialhaag**])

### Fixed

- 🐛 Isolate scikit-build output from the direct CMake build tree ([#147])
([**@burgholzer**])

## [1.0.1] - 2026-06-26

### Fixed
Expand All @@ -48,6 +55,7 @@ _This is the initial release of the `amazon-braket-qdmi-device` project._

[#150]: https://github.com/munich-quantum-software/amazon-braket-qdmi-device/pull/150
[#149]: https://github.com/munich-quantum-software/amazon-braket-qdmi-device/pull/149
[#147]: https://github.com/munich-quantum-software/amazon-braket-qdmi-device/pull/147
[#130]: https://github.com/munich-quantum-software/amazon-braket-qdmi-device/pull/130
[#117]: https://github.com/munich-quantum-software/amazon-braket-qdmi-device/pull/117

Expand Down
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ endif()

# add test code
if(BUILD_AMAZON_BRAKET_TESTS)
get_target_property(AMAZON_BRAKET_QDMI_DEVICE_ID ${QDMI_TARGET_NAME} QDMI_DEVICE_ID)
get_target_property(AMAZON_BRAKET_QDMI_DEVICE_PREFIX ${QDMI_TARGET_NAME} QDMI_DEVICE_PREFIX)
if(NOT AMAZON_BRAKET_QDMI_DEVICE_ID STREQUAL "amazon.braket.default")
message(FATAL_ERROR "The Amazon Braket QDMI target does not export its stable device ID")
endif()
if(NOT AMAZON_BRAKET_QDMI_DEVICE_PREFIX STREQUAL "${QDMI_PREFIX}")
message(FATAL_ERROR "The Amazon Braket QDMI target does not export its symbol prefix")
endif()

enable_testing()
include(GoogleTest)
add_subdirectory(test)
Expand Down
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,60 @@ cmake -S . -B build -DCMAKE_PREFIX_PATH=/path/to/install
cmake --build build
```

### Using the Device with MQT Core

The installed CMake target exports the stable device ID `amazon.braket.default`
and the `AMAZON_BRAKET` symbol prefix. An application using MQT Core 3.8 or
newer can copy the device library and a relocatable manifest beside its
executable:

```cmake
find_package(mqt-core 3.8 CONFIG REQUIRED)
find_package(amazon-braket-qdmi-device CONFIG REQUIRED)

add_executable(my_app main.cpp)
target_link_libraries(my_app PRIVATE MQT::CoreFoMaC)
mqt_copy_qdmi_runtime(my_app amazon-braket-qdmi-device)
```

This placement is discovered automatically when the MQT Core Driver is linked
statically into the executable. A dynamically linked Driver searches beside its
own shared library instead; in that case, place the generated manifest there or
register the definition explicitly as shown below.

Python consumers can use the same metadata to preserve any existing
`amazon.braket.default` configuration and apply credentials or a device ARN to
each fresh session:

```python
from pathlib import Path

from amazon.braket.qdmi import (
AMAZON_BRAKET_QDMI_DEVICE_ID,
AMAZON_BRAKET_QDMI_LIBRARY_PATH,
AMAZON_BRAKET_QDMI_PREFIX,
)
from mqt.core.fomac import DeviceDefinition, open_device, register_device_if_absent

register_device_if_absent(
DeviceDefinition(
AMAZON_BRAKET_QDMI_DEVICE_ID,
AMAZON_BRAKET_QDMI_LIBRARY_PATH,
AMAZON_BRAKET_QDMI_PREFIX,
)
)
device = open_device(
AMAZON_BRAKET_QDMI_DEVICE_ID,
base_url="arn:aws:braket:::device/quantum-simulator/amazon/sv1",
auth_file=Path("/path/to/credentials"),
custom2="us-east-1", # AMAZON_BRAKET_QDMI_DEVICE_SESSION_PARAMETER_REGION
)
```

`register_device_if_absent` does not replace definitions from `qdmi.json`,
`[tool.qdmi]`, or another higher-precedence configuration source. The explicit
arguments to `open_device` override only that newly opened session.

### CMake Options

| Option | Default | Description |
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ build = [
"scikit-build-core>=0.11.6"
]
test = [
"mqt-core~=3.8.0",
"pytest>=9.0.2",
"pytest-console-scripts>=1.4.1",
"pytest-cov>=7.0.0",
Expand Down Expand Up @@ -175,6 +176,7 @@ convention = "google"
default.extend-ignore-re = [
"(?Rm)^.*(#|//)\\s*spellchecker:disable-line$", # ignore line
"(?s)(#|//)\\s*spellchecker:off.*?\\n\\s*(#|//)\\s*spellchecker:on", # ignore block
"FoMaC",
]

[tool.typos.default.extend-words]
Expand Down
5 changes: 5 additions & 0 deletions python/amazon/braket/qdmi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,16 @@

__all__ = [
"AMAZON_BRAKET_QDMI_CMAKE_DIR",
"AMAZON_BRAKET_QDMI_DEVICE_ID",
"AMAZON_BRAKET_QDMI_INCLUDE_DIR",
"AMAZON_BRAKET_QDMI_LIBRARY_PATH",
"AMAZON_BRAKET_QDMI_PREFIX",
"__version__",
]

AMAZON_BRAKET_QDMI_DEVICE_ID = "amazon.braket.default"
AMAZON_BRAKET_QDMI_PREFIX = "AMAZON_BRAKET"


def __dir__() -> list[str]:
return __all__
Expand Down
9 changes: 9 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,15 @@ target_sources(
target_link_libraries(${QDMI_TARGET_NAME} PRIVATE qdmi::qdmi_project_warnings
${QDMI_DEVICE_OBJECTS} ${QDMI_PARSER_OBJECTS})

# Publish the stable metadata needed by QDMI driver integrations to package this separately built
# device implementation.
set_target_properties(${QDMI_TARGET_NAME} PROPERTIES QDMI_DEVICE_ID amazon.braket.default
QDMI_DEVICE_PREFIX ${QDMI_PREFIX})
set_property(
TARGET ${QDMI_TARGET_NAME}
APPEND
PROPERTY EXPORT_PROPERTIES QDMI_DEVICE_ID QDMI_DEVICE_PREFIX)

option(ENABLE_COVERAGE "Enable coverage reporting" OFF)
if(ENABLE_COVERAGE)
target_link_libraries(${QDMI_DEVICE_OBJECTS} PUBLIC qdmi::qdmi_coverage_flags)
Expand Down
8 changes: 8 additions & 0 deletions test/python/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@

from amazon.braket.qdmi import (
AMAZON_BRAKET_QDMI_CMAKE_DIR,
AMAZON_BRAKET_QDMI_DEVICE_ID,
AMAZON_BRAKET_QDMI_INCLUDE_DIR,
AMAZON_BRAKET_QDMI_LIBRARY_PATH,
AMAZON_BRAKET_QDMI_PREFIX,
__version__,
)

Expand All @@ -36,6 +38,12 @@ def test_version_exists() -> None:
assert len(__version__) > 0


def test_qdmi_device_metadata() -> None:
"""Test that the stable device metadata matches the native library."""
assert AMAZON_BRAKET_QDMI_DEVICE_ID == "amazon.braket.default"
assert AMAZON_BRAKET_QDMI_PREFIX == "AMAZON_BRAKET"


def test_include_dir_exists() -> None:
"""Test that AMAZON_BRAKET_QDMI_INCLUDE_DIR exists and is a directory."""
assert AMAZON_BRAKET_QDMI_INCLUDE_DIR.exists()
Expand Down
41 changes: 41 additions & 0 deletions test/python/test_mqt_core.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright (c) 2025 - 2026 Munich Quantum Software Company GmbH
# All rights reserved.
#
# Licensed under the Apache License v2.0 with LLVM Exceptions (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://llvm.org/LICENSE.txt
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

"""Hermetic integration tests for MQT Core's stable QDMI device registry."""

from __future__ import annotations

from mqt.core.fomac import DeviceDefinition, register_device_if_absent

from amazon.braket.qdmi import (
AMAZON_BRAKET_QDMI_LIBRARY_PATH,
AMAZON_BRAKET_QDMI_PREFIX,
)

TEST_DEVICE_ID = "test.amazon.braket.packaged"


def test_register_device_if_absent() -> None:
"""Register the packaged device without loading it or contacting AWS."""
definition = DeviceDefinition(
TEST_DEVICE_ID,
AMAZON_BRAKET_QDMI_LIBRARY_PATH,
AMAZON_BRAKET_QDMI_PREFIX,
)

assert register_device_if_absent(definition)
assert not register_device_if_absent(definition)
36 changes: 36 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading