Skip to content

Commit

Permalink
Merge branch 'master' into fix-doc-typo
Browse files Browse the repository at this point in the history
  • Loading branch information
mhucka authored Dec 6, 2024
2 parents 3ced905 + ce93e84 commit d2b0103
Show file tree
Hide file tree
Showing 88 changed files with 1,017 additions and 681 deletions.
3 changes: 2 additions & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
5.3.0
6.5.0
# NOTE: Update Bazel version in tensorflow/tools/ci_build/release/common.sh.oss
49 changes: 27 additions & 22 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: '3.9'
python-version: '3.10'
architecture: 'x64'
- name: Install Lint tools
run: pip install --upgrade pip setuptools; pip install -r requirements.txt;
Expand All @@ -26,7 +26,7 @@ jobs:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: '3.9'
python-version: '3.10'
architecture: 'x64'
- name: Install Format tools
run: pip install --upgrade pip setuptools; pip install -r requirements.txt; sudo apt-get install -y clang-format-6.0
Expand All @@ -41,7 +41,7 @@ jobs:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: '3.9'
python-version: '3.10'
architecture: 'x64'
- name: Install Bazel on CI
run: ./scripts/ci_install.sh
Expand All @@ -61,7 +61,7 @@ jobs:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: '3.9'
python-version: '3.10'
architecture: 'x64'
- name: Install Bazel on CI
run: ./scripts/ci_install.sh
Expand All @@ -70,23 +70,28 @@ jobs:
- name: Full Library Test
run: ./scripts/test_all.sh

leak-tests:
name: Memory Leak tests
runs-on: ubuntu-20.04
needs: [lint, format]

steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: '3.9'
architecture: 'x64'
- name: Install Bazel on CI
run: ./scripts/ci_install.sh
- name: Configure CI TF
run: echo "Y\n" | ./configure.sh
- name: Leak Test qsim and src
run: ./scripts/msan_test.sh
# 2024-11-30 [mhucka] temporarily turning off leak-tests because it produces
# false positives on GH that we can't immediately address. TODO: if updating
# TFQ to use Clang and the latest TF does not resolve this, find a way to
# skip the handful of failing tests and renable the rest of the msan tests.
#
# leak-tests:
# name: Memory Leak tests
# runs-on: ubuntu-20.04
# needs: [lint, format]
#
# steps:
# - uses: actions/checkout@v1
# - uses: actions/setup-python@v1
# with:
# python-version: '3.10'
# architecture: 'x64'
# - name: Install Bazel on CI
# run: ./scripts/ci_install.sh
# - name: Configure CI TF
# run: echo "Y\n" | ./configure.sh
# - name: Leak Test qsim and src
# run: ./scripts/msan_test.sh

tutorials-test:
name: Tutorial tests
Expand All @@ -97,7 +102,7 @@ jobs:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: '3.9'
python-version: '3.10'
architecture: 'x64'
- name: Install notebook dependencies
run: pip install --upgrade pip seaborn==0.10.0
Expand Down
181 changes: 164 additions & 17 deletions .github/workflows/cirq_compatibility.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,171 @@
name: Cirq Compatibility
# Copyright 2024 The TensorFlow Quantum Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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.

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Summary: GitHub CI workflow for testing TFQ against Cirq releases
#
# This workflow is executed every night on a schedule. By default, this
# workflow will save Bazel build artifacts if an error occurs during a run.
#
# For testing, this workflow can be invoked manually from the GitHub page at
# https://github.com/tensorflow/quantum/actions/workflows/cirq_compatibility.yaml
# Clicking the "Run workflow" button there will present a form interface with
# options for overridding some of the parameters for the run.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

name: Cirq compatibility tests

# Default values. These can be overridden when workflow dispatch is used.
env:
# Python version to test against.
py_version: '3.10'
# Bazel version. Note: this needs to match what is used in TF & TFQ.
bazel_version: 6.5.0
# Machine architecture.
arch: x64
# Additional .bazelrc options to use.
bazelrc_additions: |
common --announce_rc
build --verbose_failures
test --test_timeout=3000
on:
# Nightly runs.
schedule:
- cron: "0 0 * * *"
- cron: 0 0 * * *
# Manual on-demand invocations.
workflow_dispatch:
inputs:
py_version:
description: Version of Python to use
bazel_version:
description: Version of Bazel Python to use
arch:
description: Computer architecture to use
use_bazel_disk_cache:
description: Use Bazel disk_cache between runs?
type: boolean
default: true
cache_bazel_tests:
description: Allow Bazel to cache test results?
type: boolean
default: true
save_artifacts:
description: Make Bazel build outputs downloadable?
type: boolean
default: true

jobs:
consistency:
name: Nightly Compatibility
runs-on: ubuntu-16.04
test-compatibility:
name: Run TFQ tests
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
- name: Check out a copy of the TFQ git repository
uses: actions/checkout@v4

- name: Set up Python
id: python
uses: actions/setup-python@v5
with:
python-version: ${{github.event.inputs.py_version || env.py_version}}
architecture: ${{github.event.inputs.arch || env.arch}}
cache: pip

- name: Install TensorFlow Quantum dependencies
run: |
pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
- name: Install the nightly build version of Cirq
run: |
pip install -U cirq --pre
- name: Configure Bazel options
run: |
# If we didn't get a cache hit on the installed Python environment,
# something's changed, and we want to make sure to re-run all tests.
if [[ "${{steps.python.outputs.cache-hit}}" == "true"
&& "${{github.event.inputs.cache_bazel_tests}}" != "false" ]]; then
echo "cache_bazel_tests=auto" >> "$GITHUB_ENV"
else
echo "cache_bazel_tests=no" >> "$GITHUB_ENV"
fi
# Use the disk cache unless told not to.
if [[ "${{github.event.inputs.use_bazel_disk_cache}}" != "false" ]]; then
echo "use_bazel_disk_cache=true" >> "$GITHUB_ENV"
else
echo "use_bazel_disk_cache=false" >> "$GITHUB_ENV"
fi
- name: Set up Bazel with caching
if: env.use_bazel_disk_cache == 'true'
uses: bazel-contrib/[email protected]
env:
USE_BAZEL_VERSION: ${{github.event.inputs.bazel_version || env.bazel_version}}
with:
disk-cache: ${{github.workflow}}
bazelisk-cache: true
external-cache: true
repository-cache: true
bazelrc: |
${{env.bazelrc_additions}}
test --cache_test_results=${{env.cache_bazel_tests}}
- name: Set up Bazel without caching
if: env.use_bazel_disk_cache == 'false'
uses: bazel-contrib/[email protected]
env:
USE_BAZEL_VERSION: ${{github.event.inputs.bazel_version || env.bazel_version}}
with:
bazelrc: |
${{env.bazelrc_additions}}
test --cache_test_results=${{env.cache_bazel_tests}}
- name: Configure TFQ
run: |
set -x -e
# Save information to the run log, in case it's needed for debugging.
which python
python --version
python -c 'import site; print(site.getsitepackages())'
python -c 'import tensorflow; print(tensorflow.version.VERSION)'
python -c 'import cirq; print(cirq.__version__)'
# Run the TFQ configuration script.
printf "Y\n" | ./configure.sh
- name: Run TFQ tests
# TODO: when the msan tests are working again, replace the "touch"
# line with ./scripts/msan_test.sh 2>&1 | tee msan-tests-output.log
run: |
set -x -e
./scripts/test_all.sh 2>&1 | tee main-tests-output.log
touch msan-tests-output.log
- name: Make Bazel artifacts downloadable (if desired)
if: >-
github.event.inputs.save_artifacts == 'true'
&& (failure() || github.event_name == 'workflow_dispatch')
uses: actions/upload-artifact@v4
with:
python-version: '3.8'
architecture: 'x64'
- name: Install Bazel on CI
run: ./scripts/ci_install.sh
- name: Configure CI TF
run: echo "Y\n" | ./configure.sh
- name: Install Cirq nightly
run: pip install -U cirq --pre
- name: Nightly tests
run: ./scripts/test_all.sh
name: bazel-out
retention-days: 7
include-hidden-files: true
path: |
main-tests-output.log
msan-tests-output.log
/home/runner/.bazel/execroot/__main__/bazel-out/
!/home/runner/.bazel/execroot/__main__/bazel-out/**/*.so
!/home/runner/.bazel/execroot/__main__/bazel-out/**/*.o
!/home/runner/.bazel/execroot/__main__/bazel-out/**/_objs
!/home/runner/.bazel/execroot/__main__/bazel-out/**/_solib_k8
37 changes: 22 additions & 15 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# This file includes external dependencies that are required to compile the
# TensorFlow op.



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

EIGEN_COMMIT = "3bb6a48d8c171cf20b5f8e48bfb4e424fbd4f79e"
EIGEN_SHA256 = "eca9847b3fe6249e0234a342b78f73feec07d29f534e914ba5f920f3e09383a3"


EIGEN_COMMIT = "aa6964bf3a34fd607837dd8123bc42465185c4f8"


http_archive(
Expand All @@ -16,7 +19,6 @@ cc_library(
visibility = ["//visibility:public"],
)
""",
sha256 = EIGEN_SHA256,
strip_prefix = "eigen-{commit}".format(commit = EIGEN_COMMIT),
urls = [
"https://storage.googleapis.com/mirror.tensorflow.org/gitlab.com/libeigen/eigen/-/archive/{commit}/eigen-{commit}.tar.gz".format(commit = EIGEN_COMMIT),
Expand All @@ -27,35 +29,41 @@ cc_library(
http_archive(
name = "qsim",
sha256 = "b9c1eba09a885a938b5e73dfc2e02f5231cf3b01d899415caa24769346a731d5",
# patches = [
# "//third_party/tf:qsim.patch",
# ],
strip_prefix = "qsim-0.13.3",
urls = ["https://github.com/quantumlib/qsim/archive/refs/tags/v0.13.3.zip"],
)

http_archive(
name = "org_tensorflow",
sha256 = "e52cda3bae45f0ae0fccd4055e9fa29892b414f70e2df94df9a3a10319c75fff",
strip_prefix = "tensorflow-2.11.0",
patches = [
"//third_party/tf:tf.patch",
],
# sha256 = "e52cda3bae45f0ae0fccd4055e9fa29892b414f70e2df94df9a3a10319c75fff",
strip_prefix = "tensorflow-2.15.0",
urls = [
"https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.11.0.zip",
"https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.15.0.zip",
],
)


load("@org_tensorflow//tensorflow:workspace3.bzl", "workspace")
load("@org_tensorflow//tensorflow:workspace3.bzl", "tf_workspace3")

workspace()
tf_workspace3()

load("@org_tensorflow//tensorflow:workspace2.bzl", "workspace")
load("@org_tensorflow//tensorflow:workspace2.bzl", "tf_workspace2")

workspace()
tf_workspace2()

load("@org_tensorflow//tensorflow:workspace1.bzl", "workspace")
load("@org_tensorflow//tensorflow:workspace1.bzl", "tf_workspace1")

workspace()
tf_workspace1()

load("@org_tensorflow//tensorflow:workspace0.bzl", "workspace")
load("@org_tensorflow//tensorflow:workspace0.bzl", "tf_workspace0")

workspace()
tf_workspace0()

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

Expand All @@ -72,4 +80,3 @@ bind(
name = "six",
actual = "@six_archive//:six",
)

Loading

0 comments on commit d2b0103

Please sign in to comment.