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
12 changes: 6 additions & 6 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
fetch-depth: 0

- uses: actions/setup-python@v5
- uses: actions/setup-python@v6
with:
python-version: "3.12"
python-version: "3.14"

- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y doxygen graphviz

- name: Install Python package and documentation dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[docs]
python -m pip install '.[docs]'

- name: Generate C++ XML
run: |
Expand All @@ -38,7 +38,7 @@ jobs:
- name: Build HTML
run: sphinx-build -b html docs/source docs/build/html

- uses: actions/upload-pages-artifact@v3
- uses: actions/upload-pages-artifact@v5
if: github.event_name != 'pull_request'
with:
path: docs/build/html
Expand All @@ -55,4 +55,4 @@ jobs:
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@v5
85 changes: 64 additions & 21 deletions .github/workflows/mpi_test_on_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,22 @@ name: MPI test on pull request
on: pull_request

jobs:
mpi_test:
name: MPI test
runs-on: ubuntu-latest
mpi_python_test:
name: Python MPI test (${{ matrix.os }} ${{ matrix.arch }} / py${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
include:
- os: ubuntu-latest
arch: x86_64
- os: ubuntu-24.04-arm
arch: aarch64
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
fetch-depth: 0

Expand All @@ -21,9 +31,57 @@ jobs:
libboost-mpi-dev \
libboost-serialization-dev

- uses: actions/setup-python@v5
- uses: actions/setup-python@v6
with:
python-version: "3.11"
python-version: ${{ matrix.python-version }}

- name: Install qdd with MPI bindings
run: |
python -m pip install --upgrade pip build
python -m pip install mpi4py
CMAKE_ARGS="-DisMPI=ON" CC=mpicc CXX=mpicxx python -m pip install '.[test]'

- name: Run Python MPI tests
run: |
rm -rf /tmp/qdd-mpi-tests
mkdir -p /tmp/qdd-mpi-tests
cp pyproject.toml /tmp/qdd-mpi-tests/pyproject.toml
cp -r test /tmp/qdd-mpi-tests/test
cd /tmp/qdd-mpi-tests
export QDD_TEST_USE_MPI=1
mpirun --oversubscribe -np 2 python -m pytest \
-o addopts="" \
test/python \
-m "not slow and not no_mpi_support" \
--strict-markers

mpi_cpp_test:
name: C++ MPI test (${{ matrix.os }} ${{ matrix.arch }})
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm]
include:
- os: ubuntu-latest
arch: x86_64
- os: ubuntu-24.04-arm
arch: aarch64

steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Install OpenMPI and Boost
run: |
sudo apt-get update
sudo apt-get install -y \
libopenmpi-dev \
openmpi-bin \
libboost-mpi-dev \
libboost-serialization-dev

- name: Build C++ MPI tests
run: |
Expand All @@ -41,18 +99,3 @@ jobs:
mpirun --oversubscribe -np 2 ./build-mpi/test/mpi_test
mpirun --oversubscribe -np 2 ./build-mpi/test/mpi_test_grover 6
mpirun --oversubscribe -np 2 ./build-mpi/test/mpi_qcbm 6

- name: Install qdd with MPI bindings
run: |
python -m pip install --upgrade pip build
python -m pip install mpi4py
CMAKE_ARGS="-DisMPI=ON" CC=mpicc CXX=mpicxx python -m pip install .[test]

- name: Run Python MPI tests
run: |
rm -rf /tmp/qdd-mpi-tests
mkdir -p /tmp/qdd-mpi-tests
cp pyproject.toml /tmp/qdd-mpi-tests/pyproject.toml
cp -r test /tmp/qdd-mpi-tests/test
cd /tmp/qdd-mpi-tests
mpirun --oversubscribe -np 2 python -m pytest -o addopts="" test/python/test_mpi.py
8 changes: 4 additions & 4 deletions .github/workflows/publish_mpi_to_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ jobs:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
fetch-depth: 0

- uses: actions/setup-python@v5
- uses: actions/setup-python@v6
with:
python-version: "3.12"
python-version: "3.14"

- name: Install build tools
run: python -m pip install --upgrade pip build
Expand All @@ -34,7 +34,7 @@ jobs:
fi
bash scripts/build_mpi_sdist.sh

- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v7
with:
name: qdd-mpi-sdist
path: dist-mpi/*.tar.gz
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/publish_to_pypi_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,34 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm]
python-tag: ["39", "310", "311", "312", "313"]
python-tag: ["39", "310", "311", "312", "313", "314"]
include:
- os: ubuntu-latest
arch: x86_64
- os: ubuntu-24.04-arm
arch: aarch64
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: pypa/cibuildwheel@v3.3.0
env:
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
CIBW_BUILD: cp${{ matrix.python-tag }}-manylinux_${{ matrix.arch }}
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v7
with:
name: wheels-${{ matrix.arch }}-cp${{ matrix.python-tag }}
path: ./wheelhouse/*.whl

build_sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-python@v5
- uses: actions/setup-python@v6
- run: pipx run build --sdist
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v7
with:
name: sdist
path: dist/*.tar.gz
Expand All @@ -56,12 +56,12 @@ jobs:
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v7
with:
path: dist/
pattern: "wheels-*"
merge-multiple: true
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v7
with:
path: dist/
name: sdist
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/qiskit_version_test_on_pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Qiskit version test on pull request

on: pull_request

jobs:
qiskit_version_test:
name: Qiskit ${{ matrix.qiskit-version }} test (py${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- qiskit-version: "2.0"
python-version: "3.13"
- qiskit-version: "2.1"
python-version: "3.13"
- qiskit-version: "2.2"
python-version: "3.13"
- qiskit-version: "2.3"
python-version: "3.13"
- qiskit-version: "2.4"
python-version: "3.14"

steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0

- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

- name: Install package with selected Qiskit
run: |
python -m pip install --upgrade pip build
python -m pip install '.[test]' 'qiskit~=${{ matrix.qiskit-version }}.0'
python -m pip check
python -c "import qiskit; print(f'qiskit {qiskit.__version__}')"

- name: Run pytest
run: |
rm -rf /tmp/qdd-qiskit-tests
mkdir -p /tmp/qdd-qiskit-tests
cp pyproject.toml /tmp/qdd-qiskit-tests/pyproject.toml
cp -r test /tmp/qdd-qiskit-tests/test
cd /tmp/qdd-qiskit-tests
python -m pytest -m "not slow and not mpi"
8 changes: 4 additions & 4 deletions .github/workflows/test_on_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ jobs:
arch: aarch64

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
fetch-depth: 0

- uses: actions/setup-python@v5
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

- name: Install build tools
run: python -m pip install --upgrade pip build

- name: Install package and test dependencies
run: python -m pip install .[test]
run: python -m pip install '.[test]'

- name: Run pytest
run: |
Expand All @@ -55,7 +55,7 @@ jobs:
arch: aarch64

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Show CMake version
run: cmake --version
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pip install qdd
Supported environment:

- Linux x86_64 and aarch64
- Python 3.9 through 3.13
- Python 3.9 through 3.14

## Quick Start

Expand Down
2 changes: 1 addition & 1 deletion docs/source/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ complete `mpirun -n 2 python ...` example.

## Supported Environment

QDD currently targets Linux on x86_64 and aarch64 with Python 3.9 through 3.13.
QDD currently targets Linux on x86_64 and aarch64 with Python 3.9 through 3.14.
Source builds require a C++17 compiler and CMake 3.25 or newer.
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
]

dependencies = [
"qiskit~=2.2.0",
"qiskit>=2.0,<2.3; python_version < '3.10'",
"qiskit>=2.0,<2.5; python_version >= '3.10'",
]

[project.urls]
Expand Down
14 changes: 14 additions & 0 deletions test/python/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import os


if os.environ.get("QDD_TEST_USE_MPI") == "1":
from qdd.qdd_backend import QddBackend

_default_options = QddBackend._default_options.__func__

def _default_options_with_mpi(cls):
options = _default_options(cls)
options.update_options(use_mpi=True)
return options

QddBackend._default_options = classmethod(_default_options_with_mpi)
14 changes: 7 additions & 7 deletions test/python/qiskit_tutorials/advanced_circuits/test_operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ def test_using_operators_in_circuits():
# Add to a circuit
circ = QuantumCircuit(2, 2)
circ.append(xx, [0, 1])
circ.measure([0, 1], [0, 1])
backend = QddProvider().get_backend()
circ = transpile(
circ, backend, basis_gates=["rx", "ry", "rz", "cx"], seed_transpiler=50
)
job = backend.run(circ, seed_simulator=80)
circ.measure([0, 1], [0, 1])

backend = QddProvider().get_backend()
circ = transpile(
circ, basis_gates=["rx", "ry", "rz", "cx"], seed_transpiler=50
)
job = backend.run(circ, seed_simulator=80)
assert job.result().get_counts(0) == {"11": 1024}

# Add Pauli to a circuit directly
Expand Down
4 changes: 2 additions & 2 deletions test/python/qiskit_tutorials/algorithms/test_qaoa.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# The code in this file has been written using part of the code in the Qiskit tutorial:
# https://learning.quantum.ibm.com/tutorial/quantum-approximate-optimization-algorithm
import numpy as np
from qiskit.circuit.library import QAOAAnsatz
from qiskit.circuit.library import qaoa_ansatz
from qiskit.quantum_info import SparsePauliOp
from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager
from scipy.optimize import minimize
Expand Down Expand Up @@ -48,7 +48,7 @@ def build_max_cut_paulis(graph: rx.PyGraph):

cost_hamiltonian = SparsePauliOp.from_list(max_cut_paulis)

circuit = QAOAAnsatz(cost_operator=cost_hamiltonian, reps=2)
circuit = qaoa_ansatz(cost_operator=cost_hamiltonian, reps=2)
circuit.measure_all()

backend = QddProvider().get_backend()
Expand Down
Loading