Skip to content

Commit 56a6d59

Browse files
committed
Squash the commits
1 parent 7b8728d commit 56a6d59

File tree

215 files changed

+26342
-3757
lines changed

Some content is hidden

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

215 files changed

+26342
-3757
lines changed

.bazelversion

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
5.3.0

.github/workflows/ci.yaml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,27 @@ on: [pull_request]
55
jobs:
66
lint:
77
name: Lint check
8-
runs-on: ubuntu-16.04
8+
runs-on: ubuntu-20.04
99
steps:
1010
- uses: actions/checkout@v1
1111
- uses: actions/setup-python@v1
1212
with:
13-
python-version: '3.6'
13+
python-version: '3.8'
1414
architecture: 'x64'
1515
- name: Install Lint tools
16-
run: pip install --upgrade pylint
16+
run: pip install --upgrade pip setuptools; pip install -r requirements.txt;
1717
- name: Lint All
1818
run: ./scripts/lint_all.sh
1919

2020
format:
2121
name: Formatting check
22-
runs-on: ubuntu-16.04
22+
runs-on: ubuntu-20.04
2323

2424
steps:
2525
- uses: actions/checkout@v1
2626
- uses: actions/setup-python@v1
2727
with:
28-
python-version: '3.6'
28+
python-version: '3.8'
2929
architecture: 'x64'
3030
- name: Install Format tools
3131
run: pip install --upgrade pip setuptools; pip install -r requirements.txt; sudo apt-get install -y clang-format-6.0
@@ -34,13 +34,13 @@ jobs:
3434

3535
wheel-build:
3636
name: Wheel test
37-
runs-on: ubuntu-16.04
37+
runs-on: ubuntu-20.04
3838

3939
steps:
4040
- uses: actions/checkout@v1
4141
- uses: actions/setup-python@v1
4242
with:
43-
python-version: '3.6'
43+
python-version: '3.8'
4444
architecture: 'x64'
4545
- name: Install Bazel on CI
4646
run: ./scripts/ci_install.sh
@@ -53,14 +53,14 @@ jobs:
5353

5454
bazel-tests:
5555
name: Library tests
56-
runs-on: ubuntu-16.04
56+
runs-on: ubuntu-20.04
5757
needs: [lint, format]
5858

5959
steps:
6060
- uses: actions/checkout@v1
6161
- uses: actions/setup-python@v1
6262
with:
63-
python-version: '3.6'
63+
python-version: '3.8'
6464
architecture: 'x64'
6565
- name: Install Bazel on CI
6666
run: ./scripts/ci_install.sh
@@ -71,14 +71,14 @@ jobs:
7171

7272
leak-tests:
7373
name: Memory Leak tests
74-
runs-on: ubuntu-16.04
74+
runs-on: ubuntu-20.04
7575
needs: [lint, format]
7676

7777
steps:
7878
- uses: actions/checkout@v1
7979
- uses: actions/setup-python@v1
8080
with:
81-
python-version: '3.6'
81+
python-version: '3.8'
8282
architecture: 'x64'
8383
- name: Install Bazel on CI
8484
run: ./scripts/ci_install.sh
@@ -89,14 +89,14 @@ jobs:
8989

9090
tutorials-test:
9191
name: Tutorial tests
92-
runs-on: ubuntu-16.04
92+
runs-on: ubuntu-20.04
9393
needs: [lint, format, wheel-build]
9494

9595
steps:
9696
- uses: actions/checkout@v1
9797
- uses: actions/setup-python@v1
9898
with:
99-
python-version: '3.6'
99+
python-version: '3.8'
100100
architecture: 'x64'
101101
- name: Install notebook dependencies
102102
run: pip install --upgrade pip seaborn==0.10.0
@@ -107,4 +107,4 @@ jobs:
107107
- name: Build Wheel
108108
run: ./scripts/build_pip_package_test.sh
109109
- name: Test Notebooks
110-
run: ./scripts/ci_validate_tutorials.sh
110+
run: ./scripts/ci_validate_tutorials.sh
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
name: Cirq Compatibility
3+
4+
on:
5+
schedule:
6+
- cron: "0 0 * * *"
7+
8+
jobs:
9+
consistency:
10+
name: Nightly Compatibility
11+
runs-on: ubuntu-20.04
12+
steps:
13+
- uses: actions/checkout@v1
14+
- uses: actions/setup-python@v1
15+
with:
16+
python-version: '3.8'
17+
architecture: 'x64'
18+
- name: Install Bazel on CI
19+
run: ./scripts/ci_install.sh
20+
- name: Configure CI TF
21+
run: echo "Y\n" | ./configure.sh
22+
- name: Install Cirq nightly
23+
run: pip install -U cirq --pre
24+
- name: Nightly tests
25+
run: ./scripts/test_all.sh

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,7 @@ venv/*
4747

4848
# ignore emacs temp files
4949
*#
50+
51+
# vscode
52+
.vscode/*
5053
*~

WORKSPACE

Lines changed: 38 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,61 @@
11
# This file includes external dependencies that are required to compile the
2-
# TensorFlow op. Maybe of them are specific versions used by the TensorFlow
3-
# binary used. These are extracted from TF v2.3.1, tensorflow/workspace.bzl.
2+
# TensorFlow op.
43

54
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
65

7-
http_archive(
8-
name = "com_google_absl",
9-
sha256 = "f368a8476f4e2e0eccf8a7318b98dafbe30b2600f4e3cf52636e5eb145aba06a",
10-
strip_prefix = "abseil-cpp-df3ea785d8c30a9503321a3d35ee7d35808f190d",
11-
urls = [
12-
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/abseil/abseil-cpp/archive/df3ea785d8c30a9503321a3d35ee7d35808f190d.tar.gz",
13-
"https://github.com/abseil/abseil-cpp/archive/df3ea785d8c30a9503321a3d35ee7d35808f190d.tar.gz",
14-
],
15-
)
6+
EIGEN_COMMIT = "3bb6a48d8c171cf20b5f8e48bfb4e424fbd4f79e"
7+
EIGEN_SHA256 = "eca9847b3fe6249e0234a342b78f73feec07d29f534e914ba5f920f3e09383a3"
8+
169

1710
http_archive(
18-
name = "com_google_googletest",
19-
sha256 = "ff7a82736e158c077e76188232eac77913a15dac0b22508c390ab3f88e6d6d86",
20-
strip_prefix = "googletest-b6cd405286ed8635ece71c72f118e659f4ade3fb",
21-
urls = [
22-
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/google/googletest/archive/b6cd405286ed8635ece71c72f118e659f4ade3fb.zip",
23-
"https://github.com/google/googletest/archive/b6cd405286ed8635ece71c72f118e659f4ade3fb.zip",
24-
],
11+
name = "eigen",
12+
build_file_content = """
13+
cc_library(
14+
name = "eigen3",
15+
textual_hdrs = glob(["Eigen/**", "unsupported/**"]),
16+
visibility = ["//visibility:public"],
17+
)
18+
""",
19+
sha256 = EIGEN_SHA256,
20+
strip_prefix = "eigen-{commit}".format(commit = EIGEN_COMMIT),
21+
urls = [
22+
"https://storage.googleapis.com/mirror.tensorflow.org/gitlab.com/libeigen/eigen/-/archive/{commit}/eigen-{commit}.tar.gz".format(commit = EIGEN_COMMIT),
23+
"https://gitlab.com/libeigen/eigen/-/archive/{commit}/eigen-{commit}.tar.gz".format(commit = EIGEN_COMMIT),
24+
],
2525
)
2626

2727
http_archive(
28-
name = "com_google_protobuf",
29-
sha256 = "cfcba2df10feec52a84208693937c17a4b5df7775e1635c1e3baffc487b24c9b",
30-
strip_prefix = "protobuf-3.9.2",
31-
urls = [
32-
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/protocolbuffers/protobuf/archive/v3.9.2.zip",
33-
"https://github.com/protocolbuffers/protobuf/archive/v3.9.2.zip",
34-
],
28+
name = "qsim",
29+
sha256 = "f7f410a07543a51b254f7a5810b5153e196a4c7b4ec89dc8faf86f9c77eec97b",
30+
strip_prefix = "qsim-0.16.1",
31+
urls = ["https://github.com/quantumlib/qsim/archive/refs/tags/v0.16.1.zip"],
3532
)
3633

37-
# Use this zlib rule that depends on github since it is more reliable than zlib.net.
3834
http_archive(
39-
name = "zlib",
40-
build_file = "@com_google_protobuf//:third_party/zlib.BUILD",
41-
sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1",
42-
strip_prefix = "zlib-1.2.11",
35+
name = "org_tensorflow",
36+
sha256 = "e52cda3bae45f0ae0fccd4055e9fa29892b414f70e2df94df9a3a10319c75fff",
37+
strip_prefix = "tensorflow-2.11.0",
4338
urls = [
44-
"https://storage.googleapis.com/mirror.tensorflow.org/zlib.net/zlib-1.2.11.tar.gz",
45-
"https://zlib.net/zlib-1.2.11.tar.gz",
39+
"https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.11.0.zip",
4640
],
4741
)
4842

49-
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
5043

51-
protobuf_deps()
44+
load("@org_tensorflow//tensorflow:workspace3.bzl", "workspace")
5245

53-
# com_google_protobuf depends on @bazel_skylib ??
54-
http_archive(
55-
name = "bazel_skylib",
56-
sha256 = "bbccf674aa441c266df9894182d80de104cabd19be98be002f6d478aaa31574d",
57-
strip_prefix = "bazel-skylib-2169ae1c374aab4a09aa90e65efe1a3aad4e279b",
58-
urls = ["https://github.com/bazelbuild/bazel-skylib/archive/2169ae1c374aab4a09aa90e65efe1a3aad4e279b.tar.gz"],
59-
)
46+
workspace()
6047

61-
http_archive(
62-
name = "cirq",
63-
sha256 = "418cb7ff9c223e1e32516ab0ccc578385734af833528d6f5d903260b322d3362",
64-
strip_prefix = "Cirq-0.9.1",
65-
urls = ["https://github.com/quantumlib/Cirq/archive/v0.9.1.zip"],
66-
)
48+
load("@org_tensorflow//tensorflow:workspace2.bzl", "workspace")
6749

68-
http_archive(
69-
name = "qsim",
70-
sha256 = "f390ee72cf88c48d81c98262c599dc45d660a2a9308a9ee903bfa73aec08a9b4",
71-
strip_prefix = "qsim-0.6.0",
72-
urls = ["https://github.com/quantumlib/qsim/archive/v0.6.0.zip"],
73-
)
50+
workspace()
7451

75-
# Added for crosstool in tensorflow.
76-
http_archive(
77-
name = "io_bazel_rules_closure",
78-
sha256 = "5b00383d08dd71f28503736db0500b6fb4dda47489ff5fc6bed42557c07c6ba9",
79-
strip_prefix = "rules_closure-308b05b2419edb5c8ee0471b67a40403df940149",
80-
urls = [
81-
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/bazelbuild/rules_closure/archive/308b05b2419edb5c8ee0471b67a40403df940149.tar.gz",
82-
"https://github.com/bazelbuild/rules_closure/archive/308b05b2419edb5c8ee0471b67a40403df940149.tar.gz", # 2019-06-13
83-
],
84-
)
52+
load("@org_tensorflow//tensorflow:workspace1.bzl", "workspace")
8553

86-
http_archive(
87-
name = "org_tensorflow",
88-
sha256 = "6f063636673d6ef4ac60febd2541e3ad3516a57c18339a680c794b736798d054",
89-
strip_prefix = "tensorflow-2.3.1",
90-
urls = [
91-
"https://github.com/tensorflow/tensorflow/archive/v2.3.1.zip",
92-
],
93-
)
54+
workspace()
9455

95-
load("@org_tensorflow//tensorflow:workspace.bzl", "tf_workspace")
56+
load("@org_tensorflow//tensorflow:workspace0.bzl", "workspace")
9657

97-
tf_workspace(tf_repo_name = "@org_tensorflow")
58+
workspace()
9859

9960
load("//third_party/tf:tf_configure.bzl", "tf_configure")
10061

@@ -111,3 +72,7 @@ bind(
11172
name = "six",
11273
actual = "@six_archive//:six",
11374
)
75+
76+
load("//third_party/cuquantum:cuquantum_configure.bzl", "cuquantum_configure")
77+
78+
cuquantum_configure(name = "local_config_cuquantum")

benchmarks/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Some notes on benchmark configuration:
2424

2525
For example, to benchmark a dense depth-10 Clifford circuit over 5 qubits call:
2626
```
27-
bazel run -c opt --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0" --cxxopt="-msse2" \
27+
bazel run -c opt --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=1" --cxxopt="-msse2" \
2828
--cxxopt="-msse3" --cxxopt="-msse4" \
2929
benchmarks/scripts:benchmark_clifford_circuit -- \
3030
--n_moments 5 --n_qubits 4 \
@@ -39,7 +39,7 @@ benchmarks/scripts/reports/CliffordBenchmarks.benchmark_clifford_circuit_4_5_1
3939
To benchmark the parameter shift differentiation method on a random depth-10 4-qubit circuit with 10 parameters call, where the circuit will be differentiated
4040
over 50 trials, each time over a batch of 10 circuits.
4141
```
42-
bazel run -c opt --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0" --cxxopt="-msse2" \
42+
bazel run -c opt --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=1" --cxxopt="-msse2" \
4343
--cxxopt="-msse3" --cxxopt="-msse4" \
4444
benchmarks/scripts:benchmark_op_gradients -- \
4545
--n_moments 10 --n_qubits 4 --n_symbols 10 \

benchmarks/scripts/BUILD

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("@local_config_cuda//cuda:build_defs.bzl", "if_cuda_is_configured")
12
package(default_visibility = ["//visibility:public"])
23

34
licenses(["notice"])
@@ -27,6 +28,18 @@ py_test(
2728
],
2829
)
2930

31+
py_test(
32+
name = "benchmark_cuquantum_ops",
33+
srcs = ["benchmark_cuquantum_ops.py"],
34+
python_version = "PY3",
35+
deps = [
36+
"//tensorflow_quantum/core/ops:tfq_simulate_ops_cuquantum_py",
37+
"//tensorflow_quantum/core/ops:tfq_simulate_ops_py",
38+
"//tensorflow_quantum/core/serialize:serializer",
39+
"@local_config_tf//:test_log_pb2",
40+
"//tensorflow_quantum/python:util",
41+
],
42+
)
3043
py_test(
3144
name = "benchmark_op_gradients",
3245
srcs = ["benchmark_op_gradients.py"],

benchmarks/scripts/benchmark_clifford_circuit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
# ==============================================================================
14+
# =============================================================================
1515
"""Benchmark simulators against classically simulatable circuits."""
1616
import os
1717
import time

0 commit comments

Comments
 (0)