Skip to content

Commit

Permalink
Merge branch 'master' of github.com:/chensgit169/pyquafu
Browse files Browse the repository at this point in the history
# Conflicts:
#	quafu/elements/__init__.py
#	quafu/elements/element_gates/__init__.py
#	quafu/elements/element_gates/c11.py
#	quafu/elements/element_gates/c12.py
#	quafu/elements/element_gates/clifford.py
#	quafu/elements/element_gates/cm1.py
#	quafu/elements/element_gates/pauli.py
#	quafu/elements/element_gates/rotation.py
#	quafu/elements/element_gates/swap.py
#	quafu/elements/quantum_gate.py
#	quafu/elements/unitary/decomposer.py
#	tests/quafu/instruction/gates_test.py
  • Loading branch information
chensgit169 committed Dec 23, 2023
2 parents 1641fc3 + 47346cf commit f8102e9
Show file tree
Hide file tree
Showing 121 changed files with 8,658 additions and 4,530 deletions.
2 changes: 2 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DerivePointerAlignment: false
PointerAlignment: Left
10 changes: 5 additions & 5 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Lint Commit Messages
on: [push, pull_request]

jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: wagoid/commitlint-github-action@v5
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: wagoid/commitlint-github-action@v5
16 changes: 16 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: pre-commit

on:
pull_request:
push:
branches: [main]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: '3.10'
- uses: pre-commit/[email protected]
40 changes: 20 additions & 20 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
name: Unit test
on:
push:
pull_request:
branches: ['master']
push:
pull_request:
branches: [master]
jobs:
unnittest:
name: Unit test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.10'
unnittest:
name: Unit test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.10'

- name: Install dependency
run: python -m pip install -r requirements.txt && python -m pip install pytest
- name: Install dependency
run: python -m pip install -r requirements.txt && python -m pip install pytest

# TODO(zhaoyilun): Build seperate package for pyquafu-torch
- name: Install torch
run: python -m pip install torch torchvision torchaudio
- name: Install torch
run: python -m pip install torch torchvision torchaudio

- name: Install pyquafu
run: python -m pip install .
- name: Install pyquafu
run: python -m pip install .

- name: Run unit tests
run: pytest tests/
- name: Run unit tests
run: pytest tests/
100 changes: 50 additions & 50 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,59 @@
name: Build

on:
push:
branches:
- "master"
tags:
- "v*"
pull_request:
pull_request_review:
types: [submitted, edited]
workflow_dispatch:
push:
branches:
- master
tags:
- v*
pull_request:
pull_request_review:
types: [submitted, edited]
workflow_dispatch:



jobs:
build_wheels:
name: Build python wheels
strategy:
matrix:
os-arch: ["manylinux_x86_64", "win_amd64", "macosx_x86_64", "macosx_arm64"]
python-version: ["3.10"]
cibw-python: ["cp38", "cp39", "cp310","cp311"]
include:
- os-arch: "manylinux_x86_64"
os: "ubuntu-20.04"
- os-arch: "win_amd64"
os: "windows-2019"
- os-arch: "macosx_x86_64"
os: "macos-11"
- os-arch: "macosx_arm64"
os: "macos-11"
runs-on: ${{ matrix.os }}

env:
CIBW_BUILD: ${{ matrix.cibw-python }}-${{ matrix.os-arch }}
PYTHON: ${{ matrix.python-version }}
TWINE_USERNAME: "__token__"

steps:
- uses: actions/checkout@v3
build_wheels:
name: Build python wheels
strategy:
matrix:
os-arch: [manylinux_x86_64, win_amd64, macosx_x86_64, macosx_arm64]
python-version: ['3.10']
cibw-python: [cp38, cp39, cp310, cp311]
include:
- os-arch: manylinux_x86_64
os: ubuntu-20.04
- os-arch: win_amd64
os: windows-2019
- os-arch: macosx_x86_64
os: macos-13
- os-arch: macosx_arm64
os: macos-13
runs-on: ${{ matrix.os }}

# Used to host cibuildwheel
- uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Install dependence
run: python -m pip install pybind11 cibuildwheel scikit-build twine pytest

- name: Build wheels
run: python -m cibuildwheel --output-dir dist

- name: Publish package
run: python -m twine upload dist/*.whl
if: ${{ contains(github.ref, '/tags/') }}
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
CIBW_BUILD: ${{ matrix.cibw-python }}-${{ matrix.os-arch }}
PYTHON: ${{ matrix.python-version }}
TWINE_USERNAME: __token__

steps:
- uses: actions/checkout@v3

# Used to host cibuildwheel
- uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Install dependence
run: python -m pip install pybind11 cibuildwheel scikit-build twine pytest

- name: Build wheels
run: python -m cibuildwheel --output-dir dist

- name: Publish package
run: python -m twine upload dist/*.whl
if: ${{ contains(github.ref, '/tags/') }}
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ src/site
test
thirdparty
wheelhouse
*.zhaoyilun
*.png
53 changes: 53 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
repos:
- repo: https://github.com/Lucas-C/pre-commit-hooks.git
rev: v1.5.4
hooks:
- id: remove-crlf
files: (?!.*third_party)^.*$ | (?!.*book)^.*$
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files
args:
- --maxkb=20480
- id: check-merge-conflict
- id: check-symlinks
- id: detect-private-key
files: (?!.*third_party)^.*$ | (?!.*book)^.*$
- id: end-of-file-fixer
- id: trailing-whitespace
- id: requirements-txt-fixer
- id: sort-simple-yaml
- repo: https://github.com/pylint-dev/pylint
rev: v3.0.0a6
hooks:
- id: pylint
args:
- --disable=all
- --load-plugins=docstring_checker
- --enable=doc-string-one-line,doc-string-end-with,doc-string-with-all-args,doc-string-triple-quotes,doc-string-missing,doc-string-indent-error,doc-string-with-returns,doc-string-with-raises
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks.git
rev: v2.10.0
hooks:
- id: pretty-format-yaml
args: [--autofix, --indent, '4']
- repo: https://github.com/hadialqattan/pycln
rev: v2.2.2
hooks:
- id: pycln
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v15.0.7
hooks:
- id: clang-format
args: [-style=file]
# Using this mirror lets us use mypyc-compiled black, which is about 2x faster
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.12.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
args: [--profile, black, --filter-files]
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CUDA_ARCHITECTURES 70;75;80;90)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if(SKBUILD)

execute_process(
Expand Down Expand Up @@ -46,7 +47,7 @@ include(ExternalProject)
ExternalProject_Add(Eigen3
PREFIX ${EIGEN3_ROOT}
GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git
GIT_TAG 3.3.9
GIT_TAG 3.4

CONFIGURE_COMMAND ""
BUILD_COMMAND ""
Expand All @@ -56,7 +57,6 @@ ExternalProject_Add(Eigen3
)
list (APPEND PRJ_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR})


find_package(pybind11 CONFIG)
list (APPEND PRJ_INCLUDE_DIRS ${PYBIND11_INCLUDE_DIR})

Expand All @@ -74,7 +74,7 @@ if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64" OR CMAKE_HOST_SYSTEM_PROCESSOR
endif()
endif()

list (APPEND PRJ_INCLUDE_DIRS src/qfvm)
list (APPEND PRJ_INCLUDE_DIRS src/qfvm src/qfvm_clifford)
pybind11_add_module(${PROJECT_NAME} MODULE src/${PROJECT_NAME}/${PROJECT_NAME}.cpp)
add_dependencies(${PROJECT_NAME} Eigen3) #must add dependence for ninja
target_compile_options(${PROJECT_NAME} PUBLIC ${PRJ_COMPILE_OPTIONS})
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,4 @@
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.
limitations under the License.
Loading

0 comments on commit f8102e9

Please sign in to comment.