Move Eigen repository macro to its own file.

PiperOrigin-RevId: 359206609
Change-Id: I6b1f2359b683c0c9d85b7fd50603460ff7690c30
This commit is contained in:
Christian Sigg 2021-02-23 21:43:04 -08:00 committed by TensorFlower Gardener
parent 352a98d60d
commit 0effd3dc59
6 changed files with 30 additions and 13 deletions

View File

@ -33,8 +33,10 @@ if [ ! -f $BZL_FILE_PATH ]; then
exit 1;
fi
EIGEN_URL="$(grep -o 'https.*gitlab.com/libeigen/eigen/-/archive/.*tar\.gz' "${BZL_FILE_PATH}" | grep -v mirror.tensorflow | head -n1)"
EIGEN_SHA="$(eval echo $(grep '# SHARED_EIGEN_SHA' "${BZL_FILE_PATH}" | grep -o '\".*\"'))"
EIGEN_WORKSPACE_BZL_PATH="third_party/eigen3/workspace.bzl"
EIGEN_COMMIT="$(grep -oP 'EIGEN_COMMIT = "\K[0-9a-f]{40}' "${EIGEN_WORKSPACE_BZL_PATH}")"
EIGEN_URL="https://gitlab.com/libeigen/eigen/-/archive/"${EIGEN_COMMIT}"/eigen-"${EIGEN_COMMIT}".tar.gz"
EIGEN_SHA="$(grep -oP 'EIGEN_SHA256 = "\K[0-9a-f]{64}' "${EIGEN_WORKSPACE_BZL_PATH}")"
GEMMLOWP_WORKSPACE_BZL_PATH="third_party/gemmlowp/workspace.bzl"
GEMMLOWP_COMMIT="$(grep -oP 'GEMMLOWP_COMMIT = "\K[0-9a-f]{40}' "${GEMMLOWP_WORKSPACE_BZL_PATH}")"
GEMMLOWP_URL="https://storage.googleapis.com/mirror.tensorflow.org/github.com/google/gemmlowp/archive/"${GEMMLOWP_COMMIT}".zip"

View File

@ -61,7 +61,6 @@ tensorflow/third_party/curl.BUILD
tensorflow/third_party/cython.BUILD
tensorflow/third_party/dill.BUILD
tensorflow/third_party/double_conversion.BUILD
tensorflow/third_party/eigen.BUILD
tensorflow/third_party/eigen3/BUILD
tensorflow/third_party/eigen3/Eigen/Cholesky
tensorflow/third_party/eigen3/Eigen/Core
@ -73,6 +72,7 @@ tensorflow/third_party/eigen3/Eigen/SVD
tensorflow/third_party/eigen3/Eigen/SparseCholesky
tensorflow/third_party/eigen3/Eigen/SparseCore
tensorflow/third_party/eigen3/LICENSE
tensorflow/third_party/eigen3/eigen_archive.BUILD
tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/FixedPoint
tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor
tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/ThreadPool

View File

@ -26,6 +26,7 @@ load("//third_party/aws:workspace.bzl", aws = "repo")
load("//third_party/clog:workspace.bzl", clog = "repo")
load("//third_party/cpuinfo:workspace.bzl", cpuinfo = "repo")
load("//third_party/dlpack:workspace.bzl", dlpack = "repo")
load("//third_party/eigen3:workspace.bzl", eigen3 = "repo")
load("//third_party/farmhash:workspace.bzl", farmhash = "repo")
load("//third_party/flatbuffers:workspace.bzl", flatbuffers = "repo")
load("//third_party/gemmlowp:workspace.bzl", gemmlowp = "repo")
@ -190,16 +191,7 @@ def tf_repositories(path_prefix = "", tf_repo_name = ""):
absl("com_google_absl")
tf_http_archive(
name = "eigen_archive",
build_file = "//third_party:eigen.BUILD",
sha256 = "d76992f1972e4ff270221c7ee8125610a8e02bb46708a7295ee646e99287083b", # SHARED_EIGEN_SHA
strip_prefix = "eigen-90ee821c563fa20db4d64d6991ddca256d5c52f2",
urls = [
"https://storage.googleapis.com/mirror.tensorflow.org/gitlab.com/libeigen/eigen/-/archive/90ee821c563fa20db4d64d6991ddca256d5c52f2/eigen-90ee821c563fa20db4d64d6991ddca256d5c52f2.tar.gz",
"https://gitlab.com/libeigen/eigen/-/archive/90ee821c563fa20db4d64d6991ddca256d5c52f2/eigen-90ee821c563fa20db4d64d6991ddca256d5c52f2.tar.gz",
],
)
eigen3(name = "eigen_archive")
tf_http_archive(
name = "arm_compiler",

View File

@ -1,6 +1,7 @@
# Description:
# Eigen is a C++ template library for linear algebra: vectors,
# matrices, and related algorithms.
# This is the BUILD file with extra code to patch into @eigen_archive.
load("//third_party/mkl:build_defs.bzl", "if_mkl")

View File

@ -1,6 +1,7 @@
# Description:
# Eigen is a C++ template library for linear algebra: vectors,
# matrices, and related algorithms.
# This is the BUILD file used for the @eigen_archive external repository.
licenses([
# Note: Although Eigen also includes GPL V3 and LGPL v2.1+ code, TensorFlow

21
third_party/eigen3/workspace.bzl vendored Normal file
View File

@ -0,0 +1,21 @@
"""Provides the repository macro to import Eigen."""
load("//third_party:repo.bzl", "third_party_http_archive")
def repo(name):
"""Imports Eigen."""
# Attention: tools parse and update these lines.
EIGEN_COMMIT = "90ee821c563fa20db4d64d6991ddca256d5c52f2"
EIGEN_SHA256 = "d76992f1972e4ff270221c7ee8125610a8e02bb46708a7295ee646e99287083b"
third_party_http_archive(
name = name,
build_file = "//third_party/eigen3:eigen_archive.BUILD",
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),
"https://gitlab.com/libeigen/eigen/-/archive/{commit}/eigen-{commit}.tar.gz".format(commit = EIGEN_COMMIT),
],
)