Skip to content

Commit 5e2c081

Browse files
author
andi4191
committed
(//bazel): Using platform instead of cpu flag
Signed-off-by: andi4191 <[email protected]>
1 parent 922ad63 commit 5e2c081

File tree

38 files changed

+560
-569
lines changed

38 files changed

+560
-569
lines changed

BUILD

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,57 +8,55 @@ pkg_tar(
88
"//core/conversion:include",
99
"//core/conversion/conversionctx:include",
1010
"//core/conversion/converters:include",
11-
"//core/conversion/var:include",
12-
"//core/conversion/tensorcontainer:include",
13-
"//core/conversion/evaluators:include",
1411
"//core/conversion/converters/impl/plugins:include",
12+
"//core/conversion/evaluators:include",
13+
"//core/conversion/tensorcontainer:include",
14+
"//core/conversion/var:include",
1515
"//core/execution:include",
1616
"//core/lowering:include",
1717
"//core/lowering/passes:include",
1818
"//core/util:include",
19-
"//core/util/logging:include"
20-
] ,
19+
"//core/util/logging:include",
20+
],
2121
)
2222

2323
pkg_tar(
2424
name = "include",
25-
package_dir = "include/trtorch/",
2625
srcs = [
2726
"//cpp/api:api_headers",
2827
],
28+
package_dir = "include/trtorch/",
2929
)
3030

3131
pkg_tar(
3232
name = "lib",
33-
package_dir = "lib/",
3433
srcs = [
3534
"//cpp/api/lib:libtrtorch.so",
3635
],
3736
mode = "0755",
37+
package_dir = "lib/",
3838
)
3939

40-
4140
pkg_tar(
4241
name = "bin",
43-
package_dir = "bin/",
4442
srcs = [
45-
"//cpp/trtorchc:trtorchc",
43+
"//cpp/trtorchc",
4644
],
4745
mode = "0755",
46+
package_dir = "bin/",
4847
)
4948

50-
5149
pkg_tar(
5250
name = "libtrtorch",
53-
extension = "tar.gz",
54-
package_dir = "trtorch",
5551
srcs = [
56-
"//:LICENSE"
52+
"//:LICENSE",
5753
],
54+
extension = "tar.gz",
55+
package_dir = "trtorch",
5856
deps = [
59-
":lib",
6057
":bin",
6158
":include",
6259
":include_core",
60+
":lib",
6361
],
6462
)

WORKSPACE

Lines changed: 64 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -49,43 +49,41 @@ new_local_repository(
4949
# Tarballs and fetched dependencies (default - use in cases when building from precompiled bin and tarballs)
5050
#############################################################################################################
5151

52-
# TODO: Uncomment these and comment out the lower section before merge into master
53-
54-
# http_archive(
55-
# name = "libtorch",
56-
# build_file = "@//third_party/libtorch:BUILD",
57-
# strip_prefix = "libtorch",
58-
# urls = ["https://download.pytorch.org/libtorch/cu102/libtorch-cxx11-abi-shared-with-deps-1.5.0.zip"],
59-
# sha256 = "0efdd4e709ab11088fa75f0501c19b0e294404231442bab1d1fb953924feb6b5"
60-
# )
52+
http_archive(
53+
name = "libtorch",
54+
build_file = "@//third_party/libtorch:BUILD",
55+
strip_prefix = "libtorch",
56+
urls = ["https://download.pytorch.org/libtorch/cu102/libtorch-cxx11-abi-shared-with-deps-1.5.0.zip"],
57+
sha256 = "0efdd4e709ab11088fa75f0501c19b0e294404231442bab1d1fb953924feb6b5"
58+
)
6159

62-
# http_archive(
63-
# name = "libtorch_pre_cxx11_abi",
64-
# build_file = "@//third_party/libtorch:BUILD",
65-
# strip_prefix = "libtorch",
66-
# sha256 = "ea8de17c5f70015583f3a7a43c7a5cdf91a1d4bd19a6a7bc11f074ef6cd69e27",
67-
# urls = ["https://download.pytorch.org/libtorch/cu102/libtorch-shared-with-deps-1.5.0.zip"],
68-
# )
60+
http_archive(
61+
name = "libtorch_pre_cxx11_abi",
62+
build_file = "@//third_party/libtorch:BUILD",
63+
strip_prefix = "libtorch",
64+
sha256 = "ea8de17c5f70015583f3a7a43c7a5cdf91a1d4bd19a6a7bc11f074ef6cd69e27",
65+
urls = ["https://download.pytorch.org/libtorch/cu102/libtorch-shared-with-deps-1.5.0.zip"],
66+
)
6967

7068
# Download these tarballs manually from the NVIDIA website
7169
# Either place them in the distdir directory in third_party and use the --distdir flag
7270
# or modify the urls to "file:///<PATH TO TARBALL>/<TARBALL NAME>.tar.gz
7371

74-
#http_archive(
75-
# name = "cudnn",
76-
# urls = ["https://developer.nvidia.com/compute/machine-learning/cudnn/secure/7.6.5.32/Production/10.2_20191118/cudnn-10.2-linux-x64-v7.6.5.32.tgz"],
77-
# build_file = "@//third_party/cudnn/archive:BUILD",
78-
# sha256 = "600267f2caaed2fd58eb214ba669d8ea35f396a7d19b94822e6b36f9f7088c20",
79-
# strip_prefix = "cuda"
80-
#)
72+
http_archive(
73+
name = "cudnn",
74+
urls = ["https://developer.nvidia.com/compute/machine-learning/cudnn/secure/7.6.5.32/Production/10.2_20191118/cudnn-10.2-linux-x64-v7.6.5.32.tgz"],
75+
build_file = "@//third_party/cudnn/archive:BUILD",
76+
sha256 = "600267f2caaed2fd58eb214ba669d8ea35f396a7d19b94822e6b36f9f7088c20",
77+
strip_prefix = "cuda"
78+
)
8179

82-
#http_archive(
83-
# name = "tensorrt",
84-
# urls = ["https://developer.nvidia.com/compute/machine-learning/tensorrt/secure/7.0/7.0.0.11/tars/TensorRT-7.0.0.11.Ubuntu-18.04.x86_64-gnu.cuda-10.2.cudnn7.6.tar.gz"],
85-
# build_file = "@//third_party/tensorrt/archive:BUILD",
86-
# sha256 = "c7d73b2585b18aae68b740249efa8c8ba5ae852abe9a023720595432a8eb4efd",
87-
# strip_prefix = "TensorRT-7.0.0.11"
88-
#)
80+
http_archive(
81+
name = "tensorrt",
82+
urls = ["https://developer.nvidia.com/compute/machine-learning/tensorrt/secure/7.0/7.0.0.11/tars/TensorRT-7.0.0.11.Ubuntu-18.04.x86_64-gnu.cuda-10.2.cudnn7.6.tar.gz"],
83+
build_file = "@//third_party/tensorrt/archive:BUILD",
84+
sha256 = "c7d73b2585b18aae68b740249efa8c8ba5ae852abe9a023720595432a8eb4efd",
85+
strip_prefix = "TensorRT-7.0.0.11"
86+
)
8987

9088
####################################################################################
9189
# Locally installed dependencies (use in cases of custom dependencies or aarch64)
@@ -98,50 +96,50 @@ new_local_repository(
9896
# x86_64 python distribution. If using NVIDIA's version just point to the root of the package
9997
# for both versions here and do not use --config=pre-cxx11-abi
10098

101-
new_local_repository(
102-
name = "libtorch",
103-
#path = "/usr/local/lib/python3.6/dist-packages/torch",
104-
# TODO: Remove this and use the above line before merge into master
105-
path = "/home/nvidia/.local/lib/python3.6/site-packages/torch",
106-
build_file = "third_party/libtorch/BUILD"
107-
)
99+
#new_local_repository(
100+
# name = "libtorch",
101+
# path = "/usr/local/lib/python3.6/dist-packages/torch",
102+
# # Use below for aarch64
103+
# #path = "/home/nvidia/.local/lib/python3.6/site-packages/torch",
104+
# build_file = "third_party/libtorch/BUILD"
105+
#)
108106

109-
new_local_repository(
110-
name = "libtorch_pre_cxx11_abi",
111-
#path = "/usr/local/lib/python3.6/dist-packages/torch",
112-
# TODO: Remove this and use above line before merge into master
113-
path = "/home/nvidia/.local/lib/python3.6/site-packages/torch",
114-
build_file = "third_party/libtorch/BUILD"
115-
)
107+
#new_local_repository(
108+
# name = "libtorch_pre_cxx11_abi",
109+
# path = "/usr/local/lib/python3.6/dist-packages/torch",
110+
# # Use below for aarch64
111+
# #path = "/home/nvidia/.local/lib/python3.6/site-packages/torch",
112+
# build_file = "third_party/libtorch/BUILD"
113+
#)
116114

117-
new_local_repository(
118-
name = "cudnn",
119-
path = "/usr/",
120-
build_file = "@//third_party/cudnn/local:BUILD"
121-
)
115+
#new_local_repository(
116+
# name = "cudnn",
117+
# path = "/usr/",
118+
# build_file = "@//third_party/cudnn/local:BUILD"
119+
#)
122120

123-
new_local_repository(
124-
name = "tensorrt",
125-
path = "/usr/",
126-
build_file = "@//third_party/tensorrt/local:BUILD"
127-
)
121+
#new_local_repository(
122+
# name = "tensorrt",
123+
# path = "/usr/",
124+
# build_file = "@//third_party/tensorrt/local:BUILD"
125+
#)
128126

129127
#########################################################################
130128
# Testing Dependencies (optional - comment out on aarch64)
131129
#########################################################################
132130

133-
#pip3_import(
134-
# name = "trtorch_py_deps",
135-
# requirements = "//py:requirements.txt"
136-
#)
131+
pip3_import(
132+
name = "trtorch_py_deps",
133+
requirements = "//py:requirements.txt"
134+
)
137135

138-
#load("@trtorch_py_deps//:requirements.bzl", "pip_install")
139-
#pip_install()
136+
load("@trtorch_py_deps//:requirements.bzl", "pip_install")
137+
pip_install()
140138

141-
#pip3_import(
142-
# name = "py_test_deps",
143-
# requirements = "//tests/py:requirements.txt"
144-
#)
139+
pip3_import(
140+
name = "py_test_deps",
141+
requirements = "//tests/py:requirements.txt"
142+
)
145143

146-
#load("@py_test_deps//:requirements.bzl", "pip_install")
147-
#pip_install()
144+
load("@py_test_deps//:requirements.bzl", "pip_install")
145+
pip_install()

core/BUILD

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,34 @@ config_setting(
44
name = "use_pre_cxx11_abi",
55
values = {
66
"define": "abi=pre_cxx11_abi",
7-
}
7+
},
88
)
99

1010
cc_library(
1111
name = "core",
12-
hdrs = [
13-
"compiler.h",
14-
],
1512
srcs = [
1613
"compiler.cpp",
1714
],
15+
hdrs = [
16+
"compiler.h",
17+
],
1818
deps = [
1919
"//core/conversion",
2020
"//core/execution",
2121
"//core/lowering",
2222
"//core/util/logging",
23-
"@tensorrt//:nvinfer"
24-
] + select({
25-
":use_pre_cxx11_abi": ["@libtorch_pre_cxx11_abi//:libtorch"],
26-
"//conditions:default": ["@libtorch//:libtorch"],
23+
"@tensorrt//:nvinfer",
24+
] + select({
25+
":use_pre_cxx11_abi": ["@libtorch_pre_cxx11_abi//:libtorch"],
26+
"//conditions:default": ["@libtorch//:libtorch"],
2727
}),
28-
alwayslink=True,
28+
alwayslink = True,
2929
)
3030

31-
3231
load("@rules_pkg//:pkg.bzl", "pkg_tar")
3332

3433
pkg_tar(
3534
name = "include",
36-
package_dir = "core/",
3735
srcs = ["compiler.h"],
36+
package_dir = "core/",
3837
)

core/conversion/BUILD

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,36 @@ config_setting(
44
name = "use_pre_cxx11_abi",
55
values = {
66
"define": "abi=pre_cxx11_abi",
7-
}
7+
},
88
)
99

1010
cc_library(
1111
name = "conversion",
12-
hdrs = [
13-
"conversion.h",
14-
],
1512
srcs = [
13+
"InterfaceTypes.cpp",
1614
"conversion.cpp",
1715
"conversion_blacklist.cpp",
18-
"InterfaceTypes.cpp"
16+
],
17+
hdrs = [
18+
"conversion.h",
1919
],
2020
deps = [
2121
"//core/conversion/var",
2222
"//core/conversion/conversionctx",
2323
"//core/conversion/converters",
2424
"//core/conversion/evaluators",
2525
"//core/util:prelude",
26-
"@tensorrt//:nvinfer"
26+
"@tensorrt//:nvinfer",
2727
] + select({
28-
":use_pre_cxx11_abi": ["@libtorch_pre_cxx11_abi//:libtorch"],
29-
"//conditions:default": ["@libtorch//:libtorch"],
28+
":use_pre_cxx11_abi": ["@libtorch_pre_cxx11_abi//:libtorch"],
29+
"//conditions:default": ["@libtorch//:libtorch"],
3030
}),
3131
)
3232

3333
load("@rules_pkg//:pkg.bzl", "pkg_tar")
3434

3535
pkg_tar(
3636
name = "include",
37-
package_dir = "core/conversion/",
3837
srcs = ["conversion.h"],
38+
package_dir = "core/conversion/",
3939
)

core/conversion/conversionctx/BUILD

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,30 @@ config_setting(
44
name = "use_pre_cxx11_abi",
55
values = {
66
"define": "abi=pre_cxx11_abi",
7-
}
7+
},
88
)
99

1010
cc_library(
1111
name = "conversionctx",
12-
hdrs = [
13-
"ConversionCtx.h",
14-
],
1512
srcs = [
1613
"ConversionCtx.cpp",
1714
],
15+
hdrs = [
16+
"ConversionCtx.h",
17+
],
1818
deps = [
1919
"//core/util:prelude",
20-
"@tensorrt//:nvinfer"
20+
"@tensorrt//:nvinfer",
2121
] + select({
22-
":use_pre_cxx11_abi": ["@libtorch_pre_cxx11_abi//:libtorch"],
23-
"//conditions:default": ["@libtorch//:libtorch"],
22+
":use_pre_cxx11_abi": ["@libtorch_pre_cxx11_abi//:libtorch"],
23+
"//conditions:default": ["@libtorch//:libtorch"],
2424
}),
2525
)
2626

2727
load("@rules_pkg//:pkg.bzl", "pkg_tar")
2828

2929
pkg_tar(
3030
name = "include",
31-
package_dir = "core/conversion/conversionctx/",
3231
srcs = ["ConversionCtx.h"],
32+
package_dir = "core/conversion/conversionctx/",
3333
)

0 commit comments

Comments
 (0)