Add a Bazel build config for TensorPipe (#37691)
Summary:
See https://github.com/pytorch/pytorch/pull/37671 for the CI signals once the TensorPipe RPC agent is added.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/37691
Reviewed By: malfet
Differential Revision: D21359470
Pulled By: lw
fbshipit-source-id: 577dd6d73a4a11d67b50d8686628dc6d8b24201d
diff --git a/BUILD.bazel b/BUILD.bazel
index d5cd51f..6d9fd3c 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -1740,6 +1740,7 @@
"@gloo",
"@onnx",
"@fmt",
+ "@tensorpipe",
] + if_cuda(
[
":caffe2_cpp_cuda",
@@ -1776,6 +1777,7 @@
"@cudnn",
"@eigen",
"@gloo",
+ "@tensorpipe",
],
alwayslink = True,
)
diff --git a/WORKSPACE b/WORKSPACE
index 84e9956..6f5028d 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -129,6 +129,12 @@
path = "third_party/tbb",
)
+new_local_repository(
+ name = "tensorpipe",
+ build_file = "//third_party:tensorpipe.BUILD",
+ path = "third_party/tensorpipe",
+)
+
http_archive(
name = "mkl",
build_file = "//third_party:mkl.BUILD",
diff --git a/third_party/tensorpipe.BUILD b/third_party/tensorpipe.BUILD
new file mode 100644
index 0000000..9487a92
--- /dev/null
+++ b/third_party/tensorpipe.BUILD
@@ -0,0 +1,109 @@
+load("@rules_cc//cc:defs.bzl", "cc_library")
+
+LIBUV_COMMON_SRCS = [
+ "third_party/libuv/src/fs-poll.c",
+ "third_party/libuv/src/idna.c",
+ "third_party/libuv/src/inet.c",
+ "third_party/libuv/src/strscpy.c",
+ "third_party/libuv/src/threadpool.c",
+ "third_party/libuv/src/timer.c",
+ "third_party/libuv/src/uv-data-getter-setters.c",
+ "third_party/libuv/src/uv-common.c",
+ "third_party/libuv/src/version.c",
+]
+
+LIBUV_POSIX_SRCS = [
+ "third_party/libuv/src/unix/async.c",
+ "third_party/libuv/src/unix/core.c",
+ "third_party/libuv/src/unix/dl.c",
+ "third_party/libuv/src/unix/fs.c",
+ "third_party/libuv/src/unix/getaddrinfo.c",
+ "third_party/libuv/src/unix/getnameinfo.c",
+ "third_party/libuv/src/unix/loop.c",
+ "third_party/libuv/src/unix/loop-watcher.c",
+ "third_party/libuv/src/unix/pipe.c",
+ "third_party/libuv/src/unix/poll.c",
+ "third_party/libuv/src/unix/process.c",
+ "third_party/libuv/src/unix/signal.c",
+ "third_party/libuv/src/unix/stream.c",
+ "third_party/libuv/src/unix/tcp.c",
+ "third_party/libuv/src/unix/thread.c",
+ "third_party/libuv/src/unix/tty.c",
+ "third_party/libuv/src/unix/udp.c",
+]
+
+LIBUV_LINUX_SRCS = LIBUV_POSIX_SRCS + [
+ "third_party/libuv/src/unix/linux-core.c",
+ "third_party/libuv/src/unix/linux-inotify.c",
+ "third_party/libuv/src/unix/linux-syscalls.c",
+ "third_party/libuv/src/unix/procfs-exepath.c",
+ "third_party/libuv/src/unix/sysinfo-loadavg.c",
+]
+
+cc_library(
+ name = "libuv",
+ srcs = LIBUV_COMMON_SRCS + LIBUV_LINUX_SRCS,
+ includes = [
+ "third_party/libuv/include",
+ "third_party/libuv/src",
+ ],
+ hdrs = glob(
+ [
+ "third_party/libuv/include/*.h",
+ "third_party/libuv/include/uv/*.h",
+ "third_party/libuv/src/*.h",
+ "third_party/libuv/src/unix/*.h",
+ ],
+ ),
+ visibility = ["//visibility:public"],
+)
+
+proto_library(
+ name = "tensorpipe_proto_source",
+ srcs = glob([
+ "tensorpipe/proto/*.proto",
+ "tensorpipe/proto/*/*.proto",
+ ]),
+ visibility = ["//visibility:public"],
+)
+
+cc_proto_library(
+ name = "tensorpipe_protos",
+ deps = [":tensorpipe_proto_source"],
+)
+
+cc_library(
+ name = "tensorpipe",
+ srcs = glob(
+ [
+ "tensorpipe/*.cc",
+ "tensorpipe/channel/*.cc",
+ "tensorpipe/channel/*/*.cc",
+ "tensorpipe/common/*.cc",
+ "tensorpipe/core/*.cc",
+ "tensorpipe/transport/*.cc",
+ "tensorpipe/transport/*/*.cc",
+ "tensorpipe/util/*/*.cc",
+ ],
+ ),
+ hdrs = glob(
+ [
+ "tensorpipe/*.h",
+ "tensorpipe/channel/*.h",
+ "tensorpipe/channel/*/*.h",
+ "tensorpipe/common/*.h",
+ "tensorpipe/core/*.h",
+ "tensorpipe/transport/*.h",
+ "tensorpipe/transport/*/*.h",
+ "tensorpipe/util/*/*.h",
+ ],
+ ),
+ includes = [
+ ".",
+ ],
+ copts = [
+ "-std=c++14",
+ ],
+ visibility = ["//visibility:public"],
+ deps = [":tensorpipe_protos", ":libuv"],
+)