Skip to content

Commit

Permalink
Merge branch 'main' into rg/fix-cron-schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
RolandMacDoland committed Dec 13, 2023
2 parents b49c962 + c64ed02 commit 2df9dd5
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 52 deletions.
93 changes: 47 additions & 46 deletions .github/workflows/test_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,49 +12,50 @@ concurrency:


jobs:
test_qadence_ubuntu:
name: Test Qadence (ubuntu)
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
steps:
- name: Checkout Qadence
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install Hatch
run: |
pip install hatch
- name: Run tests
run: |
hatch -v run test
test_fast_qadence_windows_mac:
name: Test Qadence (Windows, MacOS)
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest]
python-version: ["3.10"]
steps:
- name: Checkout Qadence
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install Hatch
run: |
pip install hatch
- name: Run tests
run: |
hatch -v run test -m "not slow"
scheduled:
test_qadence_ubuntu:
name: Test Qadence (ubuntu)
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
steps:
- name: Checkout Qadence
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install Hatch
run: |
pip install hatch
- name: Run tests
run: |
hatch -v run test
test_fast_qadence_windows_mac:
name: Test Qadence (Windows, MacOS)
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest]
python-version: ["3.10"]
steps:
- name: Checkout Qadence
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install Hatch
run: |
pip install hatch
- name: Run tests
run: |
hatch -v run test -m "not slow"
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ authors = [
]
requires-python = ">=3.9,<3.12"
license = {text = "Apache 2.0"}
version = "1.2.1"
version = "1.2.2"
classifiers=[
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
Expand Down
1 change: 1 addition & 0 deletions qadence/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def _set_backend_config(backend: Backend, diff_mode: DiffMode) -> None:
try:
module = importlib.import_module("qadence_extensions.extensions")
available_backends = getattr(module, "available_backends")
available_engines = getattr(module, "available_engines")
supported_gates = getattr(module, "supported_gates")
get_gpsr_fns = getattr(module, "gpsr_fns")
set_backend_config = getattr(module, "set_backend_config")
Expand Down
12 changes: 7 additions & 5 deletions qadence/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,22 @@ class _BackendName(StrEnum):
"""The horqrux backend."""


class _Engine(StrEnum):
TORCH = "torch"
JAX = "jax"


# If proprietary qadence_extensions is available, import the
# right function since more backends are supported.
try:
module = importlib.import_module("qadence_extensions.types")
BackendName = getattr(module, "BackendName")
DiffMode = getattr(module, "DiffMode")
Engine = getattr(module, "Engine")
except ModuleNotFoundError:
BackendName = _BackendName
DiffMode = _DiffMode
Engine = _Engine


class StateGeneratorType(StrEnum):
Expand Down Expand Up @@ -391,10 +398,5 @@ class ReadOutOptimization(StrEnum):
CONSTRAINED = "constrained"


class Engine(StrEnum):
TORCH = "torch"
JAX = "jax"


ParamDictType = dict[str, ArrayLike]
DifferentiableExpression = Callable[..., ArrayLike]

0 comments on commit 2df9dd5

Please sign in to comment.