Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ build --define=grpc_no_ares=true
# Suppress all warning messages.
build:short_logs --output_filter=DONT_MATCH_ANYTHING

build --copt="-fvisibility=hidden"

# Force python3
build --action_env=PYTHON_BIN_PATH=python3
build --repo_env=PYTHON_BIN_PATH=python3
Expand All @@ -14,15 +16,13 @@ build:manylinux2014 --crosstool_top=//third_party/toolchains/preconfig/ubuntu16.
build -c opt
build --cxxopt="-std=c++17"
build --host_cxxopt="-std=c++17"
# We can remove this flag (we keep it explicit for now)
build --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=1"
build --host_cxxopt="-D_GLIBCXX_USE_CXX11_ABI=1"
build --auto_output_filter=subpackages
build --copt="-Wall" --copt="-Wno-sign-compare"
build --linkopt="-lrt -lm"

build --action_env MACOSX_DEPLOYMENT_TARGET=10.14

# We build with AVX and eigen byte alignment to match tensorflow's (and Eigen)
# pip package byte alignment. See b/186669968 for more details.
build --copt=-mavx --copt=-DEIGEN_MAX_ALIGN_BYTES=64
build --copt=-DEIGEN_MAX_ALIGN_BYTES=64

# TF isn't built in dbg mode, so our dbg builds will segfault due to inconsistency
# of defines when using tf's headers. In particular in refcount.h.
Expand Down
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5.3.0
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
python_bin_path.sh
bazel-*
.ipynb_checkpoints
.reverb.bazelrc
93 changes: 39 additions & 54 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,38 +1,50 @@
workspace(name = "reverb")

# To change to a version of protoc compatible with tensorflow:
# 1. Convert the required header version to a version string, e.g.:
# 3011004 => "3.11.4"
# 2. Calculate the sha256 of the binary:
# PROTOC_VERSION="3.11.4"
# curl -L "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip" | sha256sum
# 3. Update the two variables below.
#
PROTOC_VERSION = "21.0"
PROTOC_SHA256 = "a2a92003da7b8c0c08aab530a3c1967d377c2777723482adb9d2eb38c87a9d5f"
load("//tf:tf_configure.bzl", "tf_configure")

load(
"//reverb/cc/platform/default:repo.bzl",
"absl_deps",
"cc_tf_configure",
"github_apple_deps",
"github_grpc_deps",
"googletest_deps",
"protoc_deps",
"python_deps",
)
tf_configure(name = "local_config_tf")

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

absl_deps()
http_archive(
name = "pybind11",
build_file = "@pybind11_bazel//:pybind11.BUILD",
sha256 = "832e2f309c57da9c1e6d4542dedd34b24e4192ecb4d62f6f4866a737454c9970",
strip_prefix = "pybind11-2.10.4",
urls = ["https://github.com/pybind/pybind11/archive/refs/tags/v2.10.4.tar.gz"],
)
http_archive(
name = "pybind11_bazel",
sha256 = "6426567481ee345eb48661e7db86adc053881cb4dd39fbf527c8986316b682b9",
strip_prefix = "pybind11_bazel-fc56ce8a8b51e3dd941139d329b63ccfea1d304b",
urls = ["https://github.com/pybind/pybind11_bazel/archive/fc56ce8a8b51e3dd941139d329b63ccfea1d304b.zip"],
)
load("@pybind11_bazel//:python_configure.bzl", "python_configure")
python_configure(name = "local_config_python")

git_repository(
name = "com_google_snappy",
commit = "c9f9edf6d75bb065fa47468bf035e051a57bec7c",
remote = "https://github.com/google/snappy",
)

# Note that the Python dependencies are not tracked by bazel here, but
# in setup.py.
http_archive(
name = "com_github_grpc_grpc",
sha256 = "5e53505a6c84030a26c4fddd71b3f46feec8e0a8eccff2a903b189d349ca6ff5",
strip_prefix = "grpc-1.54.0",
urls = ["https://github.com/grpc/grpc/archive/refs/tags/v1.54.0.tar.gz"],
)

github_apple_deps()
ABSL_COMMIT = "fb3621f4f897824c0dbe0615fa94543df6192f30"
ABSL_SHA256 = "0320586856674d16b0b7a4d4afb22151bdc798490bb7f295eddd8f6a62b46fea"

## Begin GRPC related deps
github_grpc_deps()
http_archive(
name = "com_google_absl",
sha256 = ABSL_SHA256,
strip_prefix = "abseil-cpp-{commit}".format(commit = ABSL_COMMIT),
urls = ["https://github.com/abseil/abseil-cpp/archive/{commit}.tar.gz".format(commit = ABSL_COMMIT)],
)

load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")

Expand All @@ -41,30 +53,3 @@ grpc_deps()
load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps")

grpc_extra_deps()


load("@upb//bazel:workspace_deps.bzl", "upb_deps")

upb_deps()

load(
"@build_bazel_rules_apple//apple:repositories.bzl",
"apple_rules_dependencies",
)

apple_rules_dependencies()

load(
"@build_bazel_apple_support//lib:repositories.bzl",
"apple_support_dependencies",
)

apple_support_dependencies()
## End GRPC related deps


cc_tf_configure()

python_deps()

protoc_deps(version = PROTOC_VERSION, sha256 = PROTOC_SHA256)
24 changes: 24 additions & 0 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
import os
import subprocess
import sys
import platform
import tensorflow as tf

_REVERB_BAZELRC_FILENAME = '.reverb.bazelrc'
_REVERB_WORKSPACE_ROOT = ''
Expand Down Expand Up @@ -172,13 +174,35 @@ def setup_python(environ_cp, force_defaults: bool):
write_to_bazelrc('build --repo_env=PYTHON_BIN_PATH=\"%s"' % python_bin_path)
environ_cp['PYTHON_BIN_PATH'] = python_bin_path

write_to_bazelrc('build --spawn_strategy=standalone')
write_to_bazelrc('build --strategy=Genrule=standalone')

# If choosen python_lib_path is from a path specified in the PYTHONPATH
# variable, need to tell bazel to include PYTHONPATH
if environ_cp.get('PYTHONPATH'):
python_paths = environ_cp.get('PYTHONPATH').split(':')
if python_lib_path in python_paths:
write_action_env_to_bazelrc('PYTHONPATH', environ_cp.get('PYTHONPATH'))

cflags = tf.sysconfig.get_compile_flags()
lflags = tf.sysconfig.get_link_flags()

tf_header_dir = next(cflag[2:] for cflag in cflags if cflag.startswith('-I'))
tf_shared_dir = next(lflag[2:] for lflag in lflags if lflag.startswith('-L'))
tf_shared_lib_name = next(lflag[2:] for lflag in lflags if lflag.startswith('-l'))
lib_ext = {
'Darwin': 'dylib',
'Linux': 'so',
}[platform.system()]
tf_lib_prefix = 'lib' if platform.system() in ('Darwin', 'Linux') else ''

write_action_env_to_bazelrc('TF_HEADER_DIR', tf_header_dir)
write_action_env_to_bazelrc('TF_SHARED_LIBRARY_DIR', tf_shared_dir)
write_action_env_to_bazelrc('TF_SHARED_LIBRARY_NAME', tf_lib_prefix + tf_shared_lib_name + os.path.extsep + lib_ext)

# if platform.system() == 'Darwin':
# write_to_bazelrc('build --copt="-undefined dynamic_lookup"')

# Write tools/python_bin_path.sh
with open(os.path.join(_REVERB_WORKSPACE_ROOT, 'python_bin_path.sh'),
'w') as f:
Expand Down
113 changes: 0 additions & 113 deletions docker/release.dockerfile

This file was deleted.

Loading