Skip to content

Commit d99699b

Browse files
authored
Merge pull request #432 from tequilahub/v.1.9.10
V.1.9.10
2 parents ca6cfb7 + eb67da9 commit d99699b

File tree

135 files changed

+12166
-6913
lines changed

Some content is hidden

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

135 files changed

+12166
-6913
lines changed

.github/workflows/ci_backends.yml

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
strategy:
1818
matrix:
19-
python-version: ['3.10']
19+
python-version: ['3.11']
2020
include:
2121
- os: ubuntu-latest
2222
cxx: /usr/bin/g++-14
@@ -26,6 +26,37 @@ jobs:
2626
uses: actions/setup-python@v1
2727
with:
2828
python-version: ${{ matrix.python-version }}
29+
30+
- uses: conda-incubator/setup-miniconda@v2
31+
with:
32+
auto-activate-base: false
33+
34+
- name: Install CUDA-Q
35+
run: |
36+
cuda_version=12.4.0
37+
conda create -y -n cudaq-env python=3.11 pip
38+
conda install -y -n cudaq-env -c "nvidia/label/cuda-${cuda_version}" cuda
39+
conda install -y -n cudaq-env -c conda-forge mpi4py "openmpi>=5.0.3" cxx-compiler
40+
conda env config vars set -n cudaq-env LD_LIBRARY_PATH="$CONDA_PREFIX/envs/cudaq-env/lib:$LD_LIBRARY_PATH"
41+
conda env config vars set -n cudaq-env MPI_PATH="$CONDA_PREFIX/envs/cudaq-env"
42+
43+
source $(conda info --base)/etc/profile.d/conda.sh
44+
conda activate cudaq-env
45+
46+
# install dependencies inside cudaq-env so tequila is recognized
47+
python -m pip install --upgrade pip
48+
pip install -r requirements.txt
49+
pip install "qulacs" "qiskit==1.*" "qiskit-aer"
50+
pip install -e .
51+
52+
# Export MPI_PATH manually into the shell for the build
53+
export MPI_PATH="$CONDA_PREFIX"
54+
55+
pip install cudaq
56+
57+
# Now it can find mpi.h
58+
source $CONDA_PREFIX/lib/python3.11/site-packages/distributed_interfaces/activate_custom_mpi.sh
59+
2960
- name: Install spex
3061
run: |
3162
python -m pip install --upgrade pip
@@ -34,18 +65,28 @@ jobs:
3465
run: |
3566
python -m pip install --upgrade pip
3667
pip install -r requirements.txt
37-
pip install "qiskit" "qulacs"
68+
# TODO: Update to Qiskit 2.0
69+
pip install "qulacs" "qiskit==1.*" "qiskit-aer"
3870
# pip install cirq # installs too much stuff currently
71+
pip install "mqt.ddsim==2.0.0b2" # requires qiskit<2
3972
pip install -e .
4073
- name: Lint with flake8
4174
run: |
4275
pip install flake8
4376
# stop the build if there are Python syntax errors or undefined names
44-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
77+
# exclude simulator_cudaq.py due to its unique syntax - gates in kernel would otherwise be recognized as undeclared variables
78+
flake8 . --exclude=simulator_cudaq.py --count --select=E9,F63,F7,F82 --show-source --statistics
4579
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
46-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
80+
flake8 . --exclude=simulator_cudaq.py --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
4781
- name: Test quantum backends
48-
run: |
82+
run: |
83+
echo "import tequila as tq" > test_ci_installation.py
84+
# re initialise conda env for cudaq before running tests
85+
source $(conda info --base)/etc/profile.d/conda.sh
86+
conda activate cudaq-env
87+
echo "assert ('qulacs' in tq.INSTALLED_SIMULATORS)" >> test_ci_installation.py
88+
echo "assert ('cudaq' in tq.INSTALLED_SIMULATORS)" >> test_ci_installation.py
89+
python test_ci_installation.py
4990
pytest -m "not dependencies" tests/test_simulator_backends.py --slow
5091
pytest -m "not dependencies" tests/test_recompilation_routines.py --slow
5192
pytest -m "not dependencies" tests/test_noise.py --slow
@@ -55,4 +96,5 @@ jobs:
5596
pytest -m "not dependencies" tests/test_scipy.py --slow
5697
pytest -m "not dependencies" tests/test_gd_optimizer.py --slow
5798
pytest -m "not dependencies" tests/test_mappings.py --slow
58-
99+
pip install "quimb"
100+
pytest -m "not dependencies" tests/test_circuit_unitary.py --slow

.github/workflows/ci_basic.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,15 @@ jobs:
2828
run: |
2929
python -m pip install --upgrade pip
3030
pip install -r requirements.txt
31+
# test default simulator against in-house simulator
32+
pip install git+https://github.com/Mikel-Ma/spex@devel
3133
- name: Lint with flake8
3234
run: |
3335
pip install flake8
3436
# stop the build if there are Python syntax errors or undefined names
35-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
37+
flake8 . --exclude=simulator_cudaq.py --count --select=E9,F63,F7,F82 --show-source --statistics
3638
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
37-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
39+
flake8 . --exclude=simulator_cudaq.py --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
3840
- name: Test basic installation
3941
run: |
4042
pip install -e .

.github/workflows/ci_basic_autograd.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ jobs:
3434
run: |
3535
pip install flake8
3636
# stop the build if there are Python syntax errors or undefined names
37-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
37+
flake8 . --exclude=simulator_cudaq.py --count --select=E9,F63,F7,F82 --show-source --statistics
3838
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
39-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
39+
flake8 . --exclude=simulator_cudaq.py --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
4040
- name: Test basic installation
4141
run: |
4242
pip install -e .

.github/workflows/ci_chemistry_madness.yml

Lines changed: 0 additions & 79 deletions
This file was deleted.

.github/workflows/ci_chemistry_psi4.yml

Lines changed: 42 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -10,54 +10,50 @@ on:
1010
branches: [ master, devel ]
1111

1212
jobs:
13-
1413
build:
15-
1614
runs-on: ubuntu-latest
17-
strategy:
18-
matrix:
19-
python-version: [3.9]
2015

2116
steps:
22-
- uses: actions/checkout@v2
23-
- name: Set up Python ${{ matrix.python-version }}
24-
uses: actions/setup-python@v1
25-
with:
26-
python-version: ${{ matrix.python-version }}
27-
- name: madness basics
28-
run: |
29-
python -m pip install --upgrade pip
30-
python -m pip install -r requirements.txt
31-
python -m pip install -e .
32-
cd tests
33-
ls
34-
pytest test_chemistry_madness.py
35-
cd ../
17+
- name: Checkout the code
18+
uses: actions/checkout@v3
19+
20+
- name: Set up Conda
21+
uses: conda-incubator/setup-miniconda@v2
22+
with:
23+
miniconda-version: 'latest'
24+
auto-activate-base: false
25+
python-version: '3.10'
26+
27+
- name: Initialize Conda for the shell
28+
run: |
29+
which conda
30+
# Initialize Conda
31+
conda init bash
32+
# Restart the shell to apply changes
33+
bash
34+
35+
- name: Create Conda environment and install Psi4
36+
run: |
37+
# Create Conda environment with Python 3.10
38+
conda create --name psi4_env python=3.10 -y
39+
# Install Psi4 via Conda
40+
# some issue with qcelemental where imports fail for pydantic>2
41+
#conda install -n psi4_env -c conda-forge pydantic=1.*
42+
#conda install -n psi4_env -c psi4 psi4 -y
43+
conda install -n psi4_env psi4 python=3.10 -c conda-forge
44+
- name: Verify Python version with conda run
45+
run: |
46+
# Verify Python version inside the environment
47+
conda run -n psi4_env python --version
48+
echo "import psi4" > asd.py
49+
echo "print(psi4.__version__)" >> asd.py
50+
conda run -n psi4_env python asd.py
51+
52+
- name: Set up virtual environment and run tests
53+
run: |
3654
37-
- name: Install and test Psi4 interface
38-
run: |
39-
ver=$(python -c"import sys; print(sys.version_info.minor)")
40-
fullver=$(echo "3.$ver")
41-
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
42-
export CONDABASE=$HOME/miniconda
43-
bash miniconda.sh -b -p $CONDABASE
44-
export PATH=$CONDABASE:$PATH
45-
export PATH="$CONDABASE/bin:$PATH"
46-
conda update -q conda
47-
conda create -n test_psi4 python=$fullver
48-
conda init bash
49-
bash
50-
source $HOME/.bashrc
51-
source $CONDABASE/bin/activate
52-
conda activate test_psi4
53-
conda install psi4 python=3.9 -c conda-forge
54-
python -m pip install --upgrade pip
55-
python -m pip install -r requirements.txt
56-
python -m pip install -e .
57-
python -m pip install pyscf
58-
python -m pip install 'h5py <= 3.1'
59-
cd tests
60-
ls
61-
pytest test_chemistry.py
62-
pytest test_adapt.py
63-
cd ../
55+
conda run -n psi4_env pip install -e .
56+
conda run -n psi4_env pip install pyscf pytest
57+
cp -r tests/data data
58+
conda run -n psi4_env pytest tests/test_chemistry.py
59+
conda run -n psi4_env pytest tests/test_adapt.py

.github/workflows/ci_ruff.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Formatter and Linter
2+
on: [ push, pull_request ]
3+
4+
jobs:
5+
ruff:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v4
9+
- uses: astral-sh/ruff-action@v3
10+
with:
11+
version: "0.12.1"
12+
- run: "ruff format --check --diff"
13+
- run: "ruff check"

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,7 @@ dmypy.json
134134
/tests/experiment.py
135135
/tests/other_thing.py
136136
/examples/SearchProgress/search_progress.db
137+
138+
139+
# so you don't accidentaly push the lrz_key
140+
config.py

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ Further sources:
1818
- [talks and slides](https://kottmanj.github.io/talks_and_material/)
1919

2020
# Installation
21-
Recommended Python version is 3.9 (3.10).
22-
Tequila supports linux, osx and windows. However, not all optional dependencies are supported on windows.
21+
Recommended Python version is 3.10 (3.11).
22+
Tequila supports linux, osx and windows. However, not all optional dependencies (especially chemistry) are supported on windows.
2323

2424
## Install from PyPi
2525
**Do not** install like this: (Minecraft lovers excluded)
@@ -30,7 +30,7 @@ You can install tequila from PyPi as:
3030
pip install tequila-basic
3131
```
3232
this will install tequila with all essential dependencies.
33-
We recommend to install some fast quantum backends, like qulacs or qibo, as well.
33+
We recommend to install some fast quantum backends, like qulacs, as well.
3434
Those can be installed before or after you install tequila.
3535
```bash
3636
# install basic tequila
@@ -131,7 +131,7 @@ print("VQE : {:+2.8}f".format(result.energy))
131131
print("FCI : {:+2.8}f".format(fci))
132132
```
133133

134-
Do you want to create your own methods? Check out the [tutorials](https://github.com/tequilahub/tequila-tutorials)!
134+
Do you want to create your own methods? Check out the [tutorials]([https://github.com/tequilahub/tequila-tutorials](https://tequilahub.github.io/tequila-tutorials/))!
135135

136136
# Some Research projects using Tequila
137137
J.S. Kottmann, A. Anand, A. Aspuru-Guzik.
@@ -308,9 +308,11 @@ Here is how that works:
308308
1. Make a fork of `tequila` to your own github account.
309309
2. Checkout the `devel` branch and make sure it is up to date with the main [github repository](https://github.com/aspuru-guzik-group/tequila).
310310
3. Create and checkout a new branch from `devel` via `git branch pr-my-branch-name` followed by `git checkout pr-my-branch-name`. By typing `git branch` afterwards you can check which branch is currently checked out on your computer.
311-
4. Introduce changes to the code and commit them with git.
312-
5. Push the changes to *your* github account
313-
6. Log into github and create a pull request to the main [github repository](https://github.com/aspuru-guzik-group/tequila). The pull-request should be directed to the `devel` branch (but we can also change that afterwards).
311+
4. Introduce changes to the code.
312+
5. Format your code using [Ruff](https://github.com/astral-sh/ruff).
313+
You can install Ruff with `pip install ruff`, then run the formatter with `ruff format` and the linter with `ruff check` (most IDEs also provide a way of integrating Ruff and doing this automatically).
314+
6. Commit them with git and push the changes to *your* github account
315+
7. Log into github and create a pull request to the main [github repository](https://github.com/aspuru-guzik-group/tequila). The pull-request should be directed to the `devel` branch (but we can also change that afterwards).
314316

315317
If you plan to introduce major changes to the base library it can be beneficial to contact us first.
316318
This way we might be able to avoid conflicts before they arise.
@@ -378,4 +380,3 @@ They can be installed for example over visual studio.
378380
Tequila runs on Mac OSX.
379381
You might get in trouble with installing qulacs since it currently does not work with Apple's clang compiler.
380382
You need to install latest GNU compile (at least gcc-7 and g++7) and set them as default before installing qulacs over pip.
381-

conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Pytest configuration."""
2+
23
import pytest
34

45

0 commit comments

Comments
 (0)