Skip to content

Commit ea2eee4

Browse files
authored
Merge pull request #1 from narendasan/andi4191-anuragd/aarch64-jetpack
Fix IO issue and build system clean up
2 parents efe97ea + cad2456 commit ea2eee4

File tree

36 files changed

+598
-530
lines changed

36 files changed

+598
-530
lines changed

.bazelrc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ build --cxxopt='-std=c++14'
2929
build:python --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0"
3030
build:python --linkopt="-D_GLIBCXX_USE_CXX11_ABI=0"
3131
build:python --define=abi=pre_cxx11_abi
32-
build:python --define=abi=pre_cxx11_abi_aarch64
3332

3433
build:pre_cxx11_abi --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0"
3534
build:pre_cxx11_abi --linkopt="-D_GLIBCXX_USE_CXX11_ABI=0"
3635
build:pre_cxx11_abi --define=abi=pre_cxx11_abi
37-
build:pre_cxx11_abi_aarch64 --define abi=pre_cxx11_abi_aarch64 --cpu=aarch64

WORKSPACE

Lines changed: 76 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -25,46 +25,52 @@ http_archive(
2525
load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
2626
rules_pkg_dependencies()
2727

28-
# CUDA should be installed on the system locally
29-
#new_local_repository(
30-
# name = "cuda",
31-
# path = "/usr/local/cuda-10.2/targets/x86_64-linux/",
32-
# build_file = "@//third_party/cuda:BUILD",
33-
#)
28+
git_repository(
29+
name = "googletest",
30+
remote = "https://github.com/google/googletest",
31+
commit = "703bd9caab50b139428cea1aaff9974ebee5742e",
32+
shallow_since = "1570114335 -0400"
33+
)
3434

35-
http_archive(
36-
name = "libtorch_pre_cxx11_abi",
37-
build_file = "@//third_party/libtorch:BUILD",
38-
strip_prefix = "libtorch",
39-
sha256 = "ea8de17c5f70015583f3a7a43c7a5cdf91a1d4bd19a6a7bc11f074ef6cd69e27",
40-
urls = ["https://download.pytorch.org/libtorch/cu102/libtorch-shared-with-deps-1.5.0.zip"],
35+
# CUDA should be installed on the system locally
36+
new_local_repository(
37+
name = "cuda",
38+
path = "/usr/local/cuda-10.2/",
39+
build_file = "@//third_party/cuda:BUILD",
4140
)
4241

43-
http_archive(
44-
name = "libtorch",
45-
build_file = "@//third_party/libtorch:BUILD",
46-
strip_prefix = "libtorch",
47-
urls = ["https://download.pytorch.org/libtorch/cu102/libtorch-cxx11-abi-shared-with-deps-1.5.0.zip"],
48-
sha256 = "0efdd4e709ab11088fa75f0501c19b0e294404231442bab1d1fb953924feb6b5"
42+
new_local_repository(
43+
name = "cublas",
44+
path = "/usr",
45+
build_file = "@//third_party/cublas:BUILD",
4946
)
5047

51-
#pip3_import(
52-
# name = "trtorch_py_deps",
53-
# requirements = "//py:requirements.txt"
54-
#)
48+
#############################################################################################################
49+
# Tarballs and fetched dependencies (default - use in cases when building from precompiled bin and tarballs)
50+
#############################################################################################################
5551

56-
#load("@trtorch_py_deps//:requirements.bzl", "pip_install")
57-
#pip_install()
52+
# TODO: Uncomment these and comment out the lower section before merge into master
5853

59-
#pip3_import(
60-
# name = "py_test_deps",
61-
# requirements = "//tests/py:requirements.txt"
62-
#)
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+
# )
6361

64-
#load("@py_test_deps//:requirements.bzl", "pip_install")
65-
#pip_install()
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+
# )
69+
70+
# Download these tarballs manually from the NVIDIA website
71+
# Either place them in the distdir directory in third_party and use the --distdir flag
72+
# or modify the urls to "file:///<PATH TO TARBALL>/<TARBALL NAME>.tar.gz
6673

67-
# Downloaded distributions to use with --distdir
6874
#http_archive(
6975
# name = "cudnn",
7076
# 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"],
@@ -81,77 +87,61 @@ http_archive(
8187
# strip_prefix = "TensorRT-7.0.0.11"
8288
#)
8389

84-
## Locally installed dependencies
85-
# new_local_repository(
86-
# name = "cudnn",
87-
# path = "/usr/",
88-
# build_file = "@//third_party/cudnn/local:BUILD"
89-
#)
90-
91-
# new_local_repository(
92-
# name = "tensorrt",
93-
# path = "/usr/",
94-
# build_file = "@//third_party/tensorrt/local:BUILD"
95-
#)
90+
####################################################################################
91+
# Locally installed dependencies (use in cases of custom dependencies or aarch64)
92+
####################################################################################
9693

97-
git_repository(
98-
name = "googletest",
99-
remote = "https://github.com/google/googletest",
100-
commit = "703bd9caab50b139428cea1aaff9974ebee5742e",
101-
shallow_since = "1570114335 -0400"
102-
)
94+
# NOTE: In the case you are using just the pre-cxx11-abi path or just the cxx11 abi path
95+
# with your local libtorch, just point deps at the same path to satisfy bazel.
10396

97+
# NOTE: NVIDIA's aarch64 PyTorch (python) wheel file uses the CXX11 ABI unlike PyTorch's standard
98+
# x86_64 python distribution. If using NVIDIA's version just point to the root of the package
99+
# for both versions here and do not use --config=pre-cxx11-abi
104100

105-
###################################################
106-
# x86_64 libraries
107-
###################################################
108101
new_local_repository(
109-
name = "cuda",
110-
path = "/usr/local/cuda/targets/x86_64-linux/",
111-
build_file = "third_party/cuda/BUILD"
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"
112107
)
113108

114109
new_local_repository(
115-
name = "tensorrt",
116-
path = "/usr/local/cuda/targets/x86_64-linux/",
117-
build_file = "third_party/tensorrt/local/BUILD"
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"
118115
)
119116

120117
new_local_repository(
121118
name = "cudnn",
122-
path = "/usr/local/cuda/targets/x86_64-linux/",
123-
build_file = "third_party/cudnn/local/BUILD"
119+
path = "/usr/",
120+
build_file = "@//third_party/cudnn/local:BUILD"
124121
)
125122

126-
###################################################
127-
# ARM libraries
128-
###################################################
129123
new_local_repository(
130-
name = "cuda_aarch64",
131-
path = "/usr/local/cuda/targets/aarch64-linux-gnu",
132-
build_file = "third_party/cuda/BUILD"
124+
name = "tensorrt",
125+
path = "/usr/",
126+
build_file = "@//third_party/tensorrt/local:BUILD"
133127
)
134128

135-
new_local_repository(
136-
name = "tensorrt_aarch64",
137-
path = "/usr",
138-
build_file = "third_party/tensorrt/local/BUILD"
139-
)
129+
#########################################################################
130+
# Testing Dependencies (optional - comment out on aarch64)
131+
#########################################################################
140132

141-
new_local_repository(
142-
name = "cudnn_aarch64",
143-
path = "/usr",
144-
build_file = "third_party/cudnn/local/BUILD"
145-
)
133+
#pip3_import(
134+
# name = "trtorch_py_deps",
135+
# requirements = "//py:requirements.txt"
136+
#)
146137

147-
new_local_repository(
148-
name = "libtorch_pre_cxx11_abi_aarch64",
149-
path = "/usr/local/lib/python3.6/dist-packages/torch",
150-
build_file = "third_party/libtorch/BUILD"
151-
)
138+
#load("@trtorch_py_deps//:requirements.bzl", "pip_install")
139+
#pip_install()
152140

153-
new_local_repository(
154-
name = "libtorch_aarch64",
155-
path = "/usr/local/lib/python3.6/dist-packages/torch",
156-
build_file = "third_party/libtorch/BUILD"
157-
)
141+
#pip3_import(
142+
# name = "py_test_deps",
143+
# requirements = "//tests/py:requirements.txt"
144+
#)
145+
146+
#load("@py_test_deps//:requirements.bzl", "pip_install")
147+
#pip_install()

core/BUILD

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,6 @@ config_setting(
77
}
88
)
99

10-
config_setting(
11-
name = "use_pre_cxx11_abi_aarch64",
12-
values = {
13-
"define": "abi=pre_cxx11_abi",
14-
"cpu" : "aarch64",
15-
}
16-
)
17-
18-
config_setting(
19-
name="aarch64",
20-
values={
21-
"cpu":"aarch64"
22-
},
23-
)
24-
2510
cc_library(
2611
name = "core",
2712
hdrs = [
@@ -35,15 +20,10 @@ cc_library(
3520
"//core/execution",
3621
"//core/lowering",
3722
"//core/util/logging",
38-
] + select({
39-
":aarch64": ["@libtorch_aarch64//:libtorch",
40-
"@tensorrt_aarch64//:nvinfer"],
41-
":use_pre_cxx11_abi": ["@libtorch_pre_cxx11_abi//:libtorch",
42-
"@tensorrt//:nvinfer"],
43-
":use_pre_cxx11_abi_aarch64": ["@libtorch_pre_cxx11_abi_aarch64//:libtorch",
44-
"@tensorrt_aarch64//:nvinfer"],
45-
"//conditions:default": ["@libtorch//:libtorch",
46-
"@tensorrt//:nvinfer"],
23+
"@tensorrt//:nvinfer"
24+
] + select({
25+
":use_pre_cxx11_abi": ["@libtorch_pre_cxx11_abi//:libtorch"],
26+
"//conditions:default": ["@libtorch//:libtorch"],
4727
}),
4828
alwayslink=True,
4929
)

core/conversion/BUILD

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,6 @@ config_setting(
77
}
88
)
99

10-
config_setting(
11-
name = "use_pre_cxx11_abi_aarch64",
12-
values = {
13-
"define": "abi=pre_cxx11_abi",
14-
"cpu" : "aarch64",
15-
}
16-
)
17-
config_setting(
18-
name="aarch64",
19-
values={
20-
"cpu":"aarch64"
21-
},
22-
)
23-
2410
cc_library(
2511
name = "conversion",
2612
hdrs = [
@@ -36,16 +22,11 @@ cc_library(
3622
"//core/conversion/conversionctx",
3723
"//core/conversion/converters",
3824
"//core/conversion/evaluators",
39-
"//core/util:prelude"
25+
"//core/util:prelude",
26+
"@tensorrt//:nvinfer"
4027
] + select({
41-
":aarch64": ["@libtorch_aarch64//:libtorch",
42-
"@tensorrt_aarch64//:nvinfer"],
43-
":use_pre_cxx11_abi": ["@libtorch_pre_cxx11_abi//:libtorch",
44-
"@tensorrt//:nvinfer"],
45-
":use_pre_cxx11_abi_aarch64": ["@libtorch_pre_cxx11_abi_aarch64//:libtorch",
46-
"@tensorrt_aarch64//:nvinfer"],
47-
"//conditions:default": ["@libtorch//:libtorch",
48-
"@tensorrt//:nvinfer"],
28+
":use_pre_cxx11_abi": ["@libtorch_pre_cxx11_abi//:libtorch"],
29+
"//conditions:default": ["@libtorch//:libtorch"],
4930
}),
5031
)
5132

core/conversion/conversionctx/BUILD

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,6 @@ config_setting(
77
}
88
)
99

10-
config_setting(
11-
name = "use_pre_cxx11_abi_aarch64",
12-
values = {
13-
"define": "abi=pre_cxx11_abi",
14-
"cpu" : "aarch64",
15-
}
16-
)
17-
18-
config_setting(
19-
name="aarch64",
20-
values={
21-
"cpu":"aarch64"
22-
},
23-
)
24-
2510
cc_library(
2611
name = "conversionctx",
2712
hdrs = [
@@ -32,15 +17,10 @@ cc_library(
3217
],
3318
deps = [
3419
"//core/util:prelude",
20+
"@tensorrt//:nvinfer"
3521
] + select({
36-
":aarch64": ["@libtorch_aarch64//:libtorch",
37-
"@tensorrt_aarch64//:nvinfer"],
38-
":use_pre_cxx11_abi": ["@libtorch_pre_cxx11_abi//:libtorch",
39-
"@tensorrt//:nvinfer"],
40-
":use_pre_cxx11_abi_aarch64": ["@libtorch_pre_cxx11_abi_aarch64//:libtorch",
41-
"@tensorrt_aarch64//:nvinfer"],
42-
"//conditions:default": ["@libtorch//:libtorch",
43-
"@tensorrt//:nvinfer"],
22+
":use_pre_cxx11_abi": ["@libtorch_pre_cxx11_abi//:libtorch"],
23+
"//conditions:default": ["@libtorch//:libtorch"],
4424
}),
4525
)
4626

core/conversion/converters/BUILD

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,6 @@ config_setting(
77
}
88
)
99

10-
config_setting(
11-
name = "use_pre_cxx11_abi_aarch64",
12-
values = {
13-
"define": "abi=pre_cxx11_abi",
14-
"cpu" : "aarch64",
15-
}
16-
)
17-
18-
config_setting(
19-
name="aarch64",
20-
values={
21-
"cpu":"aarch64"
22-
},
23-
)
24-
2510
cc_library(
2611
name = "converters",
2712
hdrs = [
@@ -43,23 +28,20 @@ cc_library(
4328
"impl/shuffle.cpp",
4429
"impl/softmax.cpp",
4530
"impl/unary.cpp",
46-
"impl/interpolate.cpp"
31+
"impl/interpolate.cpp",
32+
"impl/select.cpp",
33+
"impl/stack.cpp"
4734
],
4835
deps = [
4936
"//core/util:prelude",
5037
"//core/conversion/var",
5138
"//core/conversion/tensorcontainer",
5239
"//core/conversion/conversionctx",
53-
"//core/conversion/converters/impl/plugins"
40+
"//core/conversion/converters/impl/plugins",
41+
"@tensorrt//:nvinfer"
5442
] + select({
55-
":aarch64": ["@libtorch_aarch64//:libtorch",
56-
"@tensorrt_aarch64//:nvinfer"],
57-
":use_pre_cxx11_abi": ["@libtorch_pre_cxx11_abi//:libtorch",
58-
"@tensorrt//:nvinfer"],
59-
":use_pre_cxx11_abi_aarch64": ["@libtorch_pre_cxx11_abi_aarch64//:libtorch",
60-
"@tensorrt_aarch64//:nvinfer"],
61-
"//conditions:default": ["@libtorch//:libtorch",
62-
"@tensorrt//:nvinfer"],
43+
":use_pre_cxx11_abi": ["@libtorch_pre_cxx11_abi//:libtorch"],
44+
"//conditions:default": ["@libtorch//:libtorch"],
6345
}),
6446
alwayslink = True,
6547
)

0 commit comments

Comments
 (0)