Skip to content

Commit c8ea9b7

Browse files
committed
fix(//notebooks): Fix WORKSPACE template file to reflect new build system layout
Signed-off-by: Naren Dasan <[email protected]> Signed-off-by: Naren Dasan <[email protected]>
1 parent 73d804b commit c8ea9b7

File tree

3 files changed

+72
-48
lines changed

3 files changed

+72
-48
lines changed

notebooks/Dockerfile.notebook

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM nvcr.io/nvidia/pytorch:20.03-py3
2+
3+
RUN apt update && apt install curl gnupg
4+
RUN curl https://bazel.build/bazel-release.pub.gpg | apt-key add -
5+
RUN echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list
6+
7+
RUN apt update && apt install bazel-3.3.1
8+
RUN ln -s /usr/bin/bazel-3.3.1 /usr/bin/bazel
9+
10+
RUN pip install pillow==4.3.0
11+
RUN pip install torch==1.5.1
12+
RUN pip install torchvision==0.6.1
13+
14+
COPY . /workspace/TRTorch
15+
RUN rm /workspace/TRTorch/WORKSPACE
16+
COPY ./notebooks/WORKSPACE.notebook /workspace/TRTorch/WORKSPACE
17+
18+
WORKDIR /workspace/TRTorch
19+
RUN bazel build //:libtrtorch --compilation_mode opt
20+
21+
WORKDIR /workspace/TRTorch/py
22+
RUN python3 setup.py install
23+
24+
WORKDIR /workspace/TRTorch/notebooks

notebooks/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@ This folder contains demo notebooks for TRTorch.
33

44
## 1. Requirements
55

6-
The most convenient way to run these notebooks is via a docker container, which provides a self-contained, isolated and re-producible environment for all experiments.
6+
The most convenient way to run these notebooks is via a docker container, which provides a self-contained, isolated and re-producible environment for all experiments.
77

88
First, clone the repository:
99

1010
```
1111
git clone https://github.com/NVIDIA/TRTorch
1212
```
1313

14-
Next, build the NVIDIA TRTorch container:
14+
Next, build the NVIDIA TRTorch container (from repo root):
1515

1616
```
17-
docker build -t trtorch -f Dockerfile.notebook .
17+
docker build -t trtorch -f notebooks/Dockerfile.notebook .
1818
```
1919

2020
Then launch the container with:
2121

2222
```
23-
docker run --runtime=nvidia -it --rm --ipc=host --net=host trtorch
23+
docker run --runtime=nvidia -it --rm --ipc=host --net=host trtorch
2424
```
2525

2626
Within the docker interactive bash session, start Jupyter with
@@ -38,7 +38,7 @@ in, for example:
3838
```http://[host machine]:8888/?token=aae96ae9387cd28151868fee318c3b3581a2d794f3b25c6b```
3939

4040

41-
Within the container, this notebook itself is located at `/workspace/TRTorch/notebooks`.
41+
Within the container, this notebooks itself is located at `/workspace/TRTorch/notebooks`.
4242

4343
## 2. Notebook list
4444

notebooks/WORKSPACE.notebook

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

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

42+
new_local_repository(
43+
name = "cublas",
44+
path = "/usr",
45+
build_file = "@//third_party/cublas:BUILD",
46+
)
47+
48+
#############################################################################################################
49+
# Tarballs and fetched dependencies (default - use in cases when building from precompiled bin and tarballs)
50+
#############################################################################################################
51+
3552
http_archive(
36-
name = "libtorch_pre_cxx11_abi",
53+
name = "libtorch",
3754
build_file = "@//third_party/libtorch:BUILD",
3855
strip_prefix = "libtorch",
39-
sha256 = "ea8de17c5f70015583f3a7a43c7a5cdf91a1d4bd19a6a7bc11f074ef6cd69e27",
40-
urls = ["https://download.pytorch.org/libtorch/cu102/libtorch-shared-with-deps-1.5.0.zip"],
56+
urls = ["https://download.pytorch.org/libtorch/cu102/libtorch-cxx11-abi-shared-with-deps-1.5.1.zip"],
57+
sha256 = "cf0691493d05062fe3239cf76773bae4c5124f4b039050dbdd291c652af3ab2a"
4158
)
4259

4360
http_archive(
44-
name = "libtorch",
61+
name = "libtorch_pre_cxx11_abi",
4562
build_file = "@//third_party/libtorch:BUILD",
4663
strip_prefix = "libtorch",
47-
urls = ["https://download.pytorch.org/libtorch/cu102/libtorch-cxx11-abi-shared-with-deps-1.5.0.zip"],
48-
sha256 = "0efdd4e709ab11088fa75f0501c19b0e294404231442bab1d1fb953924feb6b5"
64+
sha256 = "818977576572eadaf62c80434a25afe44dbaa32ebda3a0919e389dcbe74f8656",
65+
urls = ["https://download.pytorch.org/libtorch/cu102/libtorch-shared-with-deps-1.5.1.zip"],
66+
)
67+
68+
####################################################################################
69+
# Locally installed dependencies (use in cases of custom dependencies or aarch64)
70+
####################################################################################
71+
72+
new_local_repository(
73+
name = "cudnn",
74+
path = "/usr/",
75+
build_file = "@//third_party/cudnn/local:BUILD"
76+
)
77+
78+
new_local_repository(
79+
name = "tensorrt",
80+
path = "/usr/",
81+
build_file = "@//third_party/tensorrt/local:BUILD"
4982
)
5083

84+
#########################################################################
85+
# Testing Dependencies (optional - comment out on aarch64)
86+
#########################################################################
5187
pip3_import(
5288
name = "trtorch_py_deps",
5389
requirements = "//py:requirements.txt"
@@ -64,39 +100,3 @@ pip3_import(
64100
load("@py_test_deps//:requirements.bzl", "pip_install")
65101
pip_install()
66102

67-
## Downloaded distributions to use with --distdir
68-
#http_archive(
69-
# name = "cudnn",
70-
# 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"],
71-
# build_file = "@//third_party/cudnn/archive:BUILD",
72-
# sha256 = "600267f2caaed2fd58eb214ba669d8ea35f396a7d19b94822e6b36f9f7088c20",
73-
# strip_prefix = "cuda"
74-
#)
75-
76-
#http_archive(
77-
# name = "tensorrt",
78-
# 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"],
79-
# build_file = "@//third_party/tensorrt/archive:BUILD",
80-
# sha256 = "c7d73b2585b18aae68b740249efa8c8ba5ae852abe9a023720595432a8eb4efd",
81-
# strip_prefix = "TensorRT-7.0.0.11"
82-
#)
83-
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-
)
96-
97-
git_repository(
98-
name = "googletest",
99-
remote = "https://github.com/google/googletest",
100-
commit = "703bd9caab50b139428cea1aaff9974ebee5742e",
101-
shallow_since = "1570114335 -0400"
102-
)

0 commit comments

Comments
 (0)