Skip to content

Commit

Permalink
Add a Bazel build config for TensorPipe (pytorch#37691)
Browse files Browse the repository at this point in the history
Summary:
See pytorch#37671 for the CI signals once the TensorPipe RPC agent is added.
Pull Request resolved: pytorch#37691

Reviewed By: malfet

Differential Revision: D21359470

Pulled By: lw

fbshipit-source-id: 577dd6d73a4a11d67b50d8686628dc6d8b24201d
  • Loading branch information
lw authored and facebook-github-bot committed May 2, 2020
1 parent d639418 commit 5baa6b6
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 0 deletions.
2 changes: 2 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -1740,6 +1740,7 @@ cc_library(
"@gloo",
"@onnx",
"@fmt",
"@tensorpipe",
] + if_cuda(
[
":caffe2_cpp_cuda",
Expand Down Expand Up @@ -1776,6 +1777,7 @@ cu_library(
"@cudnn",
"@eigen",
"@gloo",
"@tensorpipe",
],
alwayslink = True,
)
Expand Down
6 changes: 6 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ new_patched_local_repository(
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",
Expand Down
109 changes: 109 additions & 0 deletions third_party/tensorpipe.BUILD
Original file line number Diff line number Diff line change
@@ -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"],
)

0 comments on commit 5baa6b6

Please sign in to comment.