Skip to content

Commit 32eb19f

Browse files
Merge branch 'master' into macos_repair_wheels
2 parents 59bafd6 + 16f223b commit 32eb19f

File tree

141 files changed

+12802
-39558
lines changed

Some content is hidden

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

141 files changed

+12802
-39558
lines changed

.github/workflows/bazeltest.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ jobs:
2626
run: git submodule update --init --recursive
2727
- name: Install Bazel on CI
2828
run: |
29-
wget https://github.com/bazelbuild/bazel/releases/download/0.26.0/bazel_0.26.0-linux-x86_64.deb
30-
sudo dpkg -i bazel_0.26.0-linux-x86_64.deb
29+
wget https://github.com/bazelbuild/bazel/releases/download/3.7.2/bazel_3.7.2-linux-x86_64.deb
30+
sudo dpkg -i bazel_3.7.2-linux-x86_64.deb
3131
- name: Run C++ tests
3232
run: |
3333
bazel test --config=${{ matrix.hardware_opt }} \
@@ -52,8 +52,8 @@ jobs:
5252
run: git submodule update --init --recursive
5353
- name: Install Bazel on CI
5454
run: |
55-
wget https://github.com/bazelbuild/bazel/releases/download/0.26.0/bazel_0.26.0-linux-x86_64.deb
56-
sudo dpkg -i bazel_0.26.0-linux-x86_64.deb
55+
wget https://github.com/bazelbuild/bazel/releases/download/3.7.2/bazel_3.7.2-linux-x86_64.deb
56+
sudo dpkg -i bazel_3.7.2-linux-x86_64.deb
5757
- name: Run C++ tests
5858
run: |
5959
bazel test --config=avx --config=openmp \
@@ -69,8 +69,8 @@ jobs:
6969
run: git submodule update --init --recursive
7070
- name: Install Bazel on CI
7171
run: |
72-
wget https://github.com/bazelbuild/bazel/releases/download/0.26.0/bazel_0.26.0-linux-x86_64.deb
73-
sudo dpkg -i bazel_0.26.0-linux-x86_64.deb
72+
wget https://github.com/bazelbuild/bazel/releases/download/3.7.2/bazel_3.7.2-linux-x86_64.deb
73+
sudo dpkg -i bazel_3.7.2-linux-x86_64.deb
7474
- name: Install google-perftools for tcmalloc
7575
run: sudo apt-get install libgoogle-perftools-dev
7676
- name: Run C++ tests

.github/workflows/cirq_compatibility.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
jobs:
88
consistency:
99
name: Nightly Compatibility
10-
runs-on: ubuntu-16.04
10+
runs-on: ubuntu-18.04
1111
steps:
1212
- uses: actions/checkout@v2
1313
- uses: actions/setup-python@v1
@@ -18,5 +18,7 @@ jobs:
1818
run: pip3 install -U cirq --pre
1919
- name: Install qsim requirements
2020
run: pip3 install -r requirements.txt
21+
- name: Install test requirements
22+
run: pip3 install -r dev-requirements.txt
2123
- name: Run python tests
2224
run: make run-py-tests

.github/workflows/python_format.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ jobs:
2424
with:
2525
python-version: '3.7'
2626
architecture: 'x64'
27-
- name: Install flynt
28-
run: cat requirements.txt | grep flynt | xargs pip install
29-
- name: Install black
30-
run: cat requirements.txt | grep black | xargs pip install
27+
- name: Install dev requirements
28+
run: pip install -r dev-requirements.txt
3129
- name: Format
3230
run: check/format-incremental

.github/workflows/release_wheels.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
name: win_amd64
2727
architecture: x64
2828
cibw:
29-
build: "cp*win_amd64"
29+
build: "cp36-win_amd64 cp37-win_amd64 cp38-win_amd64 cp39-win_amd64"
3030
env:
3131
CIBW_BUILD: "${{ matrix.cibw.build || '*' }}"
3232
CIBW_ARCHS: "${{ matrix.cibw.arch || 'auto' }}"
@@ -36,7 +36,8 @@ jobs:
3636
# to install latest delocate package
3737
CIBW_DEPENDENCY_VERSIONS: "latest"
3838
# due to package and module name conflict have to temporarily move it away to run tests
39-
CIBW_BEFORE_TEST: "mv {package}/qsimcirq /tmp"
39+
CIBW_BEFORE_TEST: mv {package}/qsimcirq /tmp
40+
CIBW_TEST_EXTRAS: "dev"
4041
CIBW_TEST_COMMAND: "pytest {package}/qsimcirq_tests/qsimcirq_test.py && mv /tmp/qsimcirq {package}"
4142
steps:
4243
- uses: actions/checkout@v2

.github/workflows/testing_wheels.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ jobs:
4242
CIBW_DEPENDENCY_VERSIONS: "latest"
4343
# due to package and module name conflict have to temporarily move it away to run tests
4444
CIBW_BEFORE_TEST: "mv {package}/qsimcirq /tmp"
45+
CIBW_TEST_EXTRAS: "dev"
4546
CIBW_TEST_COMMAND: "pytest {package}/qsimcirq_tests/qsimcirq_test.py && mv /tmp/qsimcirq {package}"
4647
steps:
4748
- uses: actions/checkout@v2

CMakeLists.txt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
cmake_minimum_required(VERSION 3.11)
2-
project(qsim)
2+
3+
execute_process(COMMAND which nvcc OUTPUT_VARIABLE has_nvcc)
4+
if(has_nvcc STREQUAL "")
5+
project(qsim)
6+
else()
7+
project(qsim LANGUAGES CXX CUDA)
8+
ADD_SUBDIRECTORY(pybind_interface/cuda)
9+
if(DEFINED ENV{CUQUANTUM_DIR})
10+
ADD_SUBDIRECTORY(pybind_interface/custatevec)
11+
endif()
12+
endif()
313

414
ADD_SUBDIRECTORY(pybind_interface/sse)
515
ADD_SUBDIRECTORY(pybind_interface/avx512)

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
include requirements.txt
2+
include dev-requirements.txt
23
include CMakeLists.txt
34

45
graft pybind_interface

Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,17 @@ CXXFLAGS = -O3 -fopenmp
1111
ARCHFLAGS = -march=native
1212
NVCCFLAGS = -O3
1313

14+
# CUQUANTUM_DIR should be set.
15+
CUSTATEVECFLAGS = -I$(CUQUANTUM_DIR)/include -L${CUQUANTUM_DIR}/lib -L$(CUQUANTUM_DIR)/lib64 -lcustatevec -lcublas
16+
1417
PYBIND11 = true
1518

1619
export CXX
1720
export CXXFLAGS
1821
export ARCHFLAGS
1922
export NVCC
2023
export NVCCFLAGS
24+
export CUSTATEVECFLAGS
2125

2226
ifeq ($(PYBIND11), true)
2327
TARGETS += pybind
@@ -35,6 +39,10 @@ qsim:
3539
qsim-cuda:
3640
$(MAKE) -C apps/ qsim-cuda
3741

42+
.PHONY: qsim-custatevec
43+
qsim-custatevec:
44+
$(MAKE) -C apps/ qsim-custatevec
45+
3846
.PHONY: pybind
3947
pybind:
4048
$(MAKE) -C pybind_interface/ pybind
@@ -47,6 +55,10 @@ cxx-tests: eigen
4755
cuda-tests:
4856
$(MAKE) -C tests/ cuda-tests
4957

58+
.PHONY: custatevec-tests
59+
custatevec-tests:
60+
$(MAKE) -C tests/ custatevec-tests
61+
5062
.PHONY: run-cxx-tests
5163
run-cxx-tests: cxx-tests
5264
$(MAKE) -C tests/ run-cxx-tests
@@ -55,6 +67,10 @@ run-cxx-tests: cxx-tests
5567
run-cuda-tests: cuda-tests
5668
$(MAKE) -C tests/ run-cuda-tests
5769

70+
.PHONY: run-custatevec-tests
71+
run-custatevec-tests: custatevec-tests
72+
$(MAKE) -C tests/ run-custatevec-tests
73+
5874
PYTESTS = $(shell find qsimcirq_tests/ -name '*_test.py')
5975

6076
.PHONY: run-py-tests

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,14 @@ located in [tests](https://github.com/quantumlib/qsim/tree/master/tests).
8585
Python tests use pytest, and are located in
8686
[qsimcirq_tests](https://github.com/quantumlib/qsim/tree/master/qsimcirq_tests).
8787

88-
To build and run all tests, navigate to the test directory and run:
88+
To build and run all tests, run:
8989
```
90-
make run-all
90+
make run-tests
9191
```
9292
This will compile all test binaries to files with `.x` extensions, and run each
93-
test in series. Testing will stop early if a test fails.
93+
test in series. Testing will stop early if a test fails. It will also run tests
94+
of the `qsimcirq` python interface. To run C++ or python tests only, run
95+
`make run-cxx-tests` or `make run-py-tests`, respectively.
9496

9597
To clean up generated test files, run `make clean` from the test directory.
9698

@@ -125,4 +127,4 @@ An equivalent BibTex format reference is below for all the versions:
125127
doi = {10.5281/zenodo.4023103},
126128
url = {https://doi.org/10.5281/zenodo.4023103}
127129
}
128-
```
130+
```

apps/Makefile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,30 @@
11
CXX_TARGETS = $(shell find . -maxdepth 1 -name '*.cc')
22
CXX_TARGETS := $(CXX_TARGETS:%.cc=%.x)
33

4-
CUDA_TARGETS = $(shell find . -maxdepth 1 -name '*.cu')
5-
CUDA_TARGETS := $(CUDA_TARGETS:%.cu=%.x)
4+
CUDA_TARGETS = $(shell find . -maxdepth 1 -name '*cuda.cu')
5+
CUDA_TARGETS := $(CUDA_TARGETS:%cuda.cu=%cuda.x)
6+
7+
CUSTATEVEC_TARGETS = $(shell find . -maxdepth 1 -name "*custatevec.cu")
8+
CUSTATEVEC_TARGETS := $(CUSTATEVEC_TARGETS:%custatevec.cu=%custatevec.x)
69

710
.PHONY: qsim
811
qsim: $(CXX_TARGETS)
912

1013
.PHONY: qsim-cuda
1114
qsim-cuda: $(CUDA_TARGETS)
1215

16+
.PHONY: qsim-custatevec
17+
qsim-custatevec: $(CUSTATEVEC_TARGETS)
18+
1319
%.x: %.cc
1420
$(CXX) -o ./$@ $< $(CXXFLAGS) $(ARCHFLAGS)
1521

16-
%.x: %.cu
22+
%cuda.x: %cuda.cu
1723
$(NVCC) -o ./$@ $< $(NVCCFLAGS)
1824

25+
%custatevec.x: %custatevec.cu
26+
$(NVCC) -o ./$@ $< $(NVCCFLAGS) $(CUSTATEVECFLAGS)
27+
1928
.PHONY: clean
2029
clean:
2130
-rm -f ./*.x ./*.a ./*.so ./*.mod

0 commit comments

Comments
 (0)