Skip to content

Commit 05b8376

Browse files
committed
refactor(//docker): Update docker container for new API
Signed-off-by: Naren Dasan <[email protected]> Signed-off-by: Naren Dasan <[email protected]>
1 parent a9ab1b4 commit 05b8376

File tree

8 files changed

+25
-122
lines changed

8 files changed

+25
-122
lines changed

core/compiler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ std::string ConvertGraphToTRTEngine(const torch::jit::script::Module& mod, std::
377377

378378
auto engine = conversion::ConvertBlockToEngine(g->block(), cfg.convert_info, static_params);
379379

380-
return std::move(engine);
380+
return engine;
381381
}
382382

383383
torch::jit::Module CompileGraph(const torch::jit::Module& mod, CompileSpec cfg) {

core/compiler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ torch::jit::script::Module EmbedEngineInNewModule(const std::string& engine, run
3131
void set_device(const int gpu_id);
3232

3333
} // namespace core
34-
} // namespace trtorch
34+
} // namespace torch_tensorrt

core/ir/StaticParams.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ StaticParams get_static_params(c10::ArrayRef<torch::jit::Value*> inputs, std::ve
2020
TRTORCH_CHECK(
2121
static_params.size() == params.size(),
2222
"Graph parameter parsing failed, mismatched number of static parameters and IValues")
23-
return std::move(static_params);
23+
return static_params;
2424
}
2525

2626
} // namespace ir

core/ir/ir.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ InputSpecMap pair_input_vals_with_specs(std::vector<const torch::jit::Value*> va
2424
LOG_DEBUG("Paring " << i << ": " << vals[i]->debugName() << " : " << specs[i]);
2525
a.insert({vals[i], specs[i]});
2626
}
27-
return std::move(a);
27+
return a;
2828
}
2929

3030
std::vector<const torch::jit::Value*> get_tensor_inputs(

core/partitioning/partitioning.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ std::vector<SegmentedBlock> segmentBlocksWithNonTensorInputs(SegmentedBlock& seg
133133
}
134134
}
135135

136-
return std::move(new_seg_blocks);
136+
return new_seg_blocks;
137137
}
138138

139139
void resolveNonTensorInputs(PartitionedGraph& segmented_blocks) { // , std::shared_ptr<torch::jit::Graph> g
@@ -385,7 +385,7 @@ PartitionedGraph segment_graph(torch::jit::Block* block, const PartitionInfo& pa
385385
finalize_block(segmented_blocks, SegmentedBlock::kTorch, in_prog_pyt_blk_nodes);
386386
}
387387

388-
return std::move(segmented_blocks);
388+
return segmented_blocks;
389389
}
390390

391391
PartitionedGraph Partition(

docker/Dockerfile

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
ARG BASE=21.06
1+
ARG BASE=21.09
22
ARG BASE_IMG=nvcr.io/nvidia/pytorch:${BASE}-py3
33
FROM ${BASE_IMG} as base
44

5-
FROM base as trtorch-builder-base
5+
FROM base as torch-tensorrt-builder-base
66

7-
# Removing any bazel or trtorch pre-installed from the base image
7+
# Removing any bazel or torch-tensorrt pre-installed from the base image
88

9-
RUN rm -rf /opt/pytorch/trtorch /usr/bin/bazel
9+
RUN rm -rf /opt/torch-tensorrt /usr/bin/bazel
1010

1111
RUN apt-get update && apt-get install --no-install-recommends -y curl gnupg
1212
RUN curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor > /etc/apt/trusted.gpg.d/bazel.gpg
@@ -20,30 +20,32 @@ RUN cp /usr/lib/x86_64-linux-gnu/libnvinfer.so /usr/lib/x86_64-linux-gnu/libnvin
2020

2121
RUN apt-get update && apt-get install -y --no-install-recommends locales ninja-build && rm -rf /var/lib/apt/lists/* && locale-gen en_US.UTF-8
2222

23-
FROM trtorch-builder-base as trtorch-builder
23+
FROM torch-tensorrt-builder-base as torch-tensorrt-builder
2424

25-
COPY . /workspace/trtorch/src
26-
WORKDIR /workspace/trtorch/src
27-
RUN cp ./docker/WORKSPACE.cu.docker WORKSPACE
25+
COPY . /workspace/torch_tensorrt/src
26+
WORKDIR /workspace/torch_tensorrt/src
27+
RUN cp ./docker/WORKSPACE.docker WORKSPACE
2828

2929
# This script builds both libtrtorch bin/lib/include tarball and the Pythin wheel, in dist/
3030
RUN ./docker/dist-build.sh
3131

32-
FROM base as trtorch
32+
FROM base as torch-tensorrt
3333

3434
# copy source repo
35-
COPY . /workspace/trtorch
36-
COPY --from=trtorch-builder /workspace/trtorch/src/dist/ .
37-
RUN patch -u /opt/conda/lib/python3.8/site-packages/pytorch_quantization/nn/modules/tensor_quantizer.py -i /workspace/trtorch/docker/qat.patch
35+
COPY . /workspace/torch_tensorrt
36+
COPY --from=torch-tensorrt-builder /workspace/torch_tensorrt/src/dist/ .
37+
RUN patch -u /opt/conda/lib/python3.8/site-packages/pytorch_quantization/nn/modules/tensor_quantizer.py -i /workspace/torch_tensorrt/docker/qat.patch
3838
RUN conda init bash
3939

4040
RUN pip3 install ipywidgets --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org
4141
RUN jupyter nbextension enable --py widgetsnbextension
4242

43-
RUN mkdir -p /opt/trtorch && tar xvf libtrtorch.tar.gz --strip-components 2 -C /opt/trtorch --exclude=LICENSE && pip3 install *.whl && rm -fr /workspace/trtorch/dist/*
43+
RUN pip3 install *.whl && rm -fr /workspace/torch_tensorrt/dist/* *.whl
4444

45-
ENV LD_LIBRARY_PATH /opt/conda/lib/python3.8/site-packages/torch/lib:/opt/trtorch/lib:${LD_LIBRARY_PATH}
46-
ENV PATH /opt/trtorch/bin:${PATH}
45+
ENV LD_LIBRARY_PATH /opt/conda/lib/python3.8/site-packages/torch/lib:/opt/conda/lib/python3.8/site-packages/torch_tensorrt/lib:${LD_LIBRARY_PATH}
46+
ENV PATH /opt/conda/lib/python3.8/site-packages/torch_tensorrt/bin:${PATH}
47+
48+
WORKDIR /workspace
49+
RUN mv /workspace/torch_tensorrt /opt/pytorch/torch_tensorrt
4750

48-
WORKDIR /workspace/trtorch/
4951
CMD /bin/bash

docker/WORKSPACE.cu.docker

Lines changed: 0 additions & 96 deletions
This file was deleted.

docker/dist-build.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22

33
mkdir -p dist
44

5-
bazel build //:libtrtorch --compilation_mode opt
6-
75
cd py && MAX_JOBS=1 LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 python3 setup.py bdist_wheel --use-cxx11-abi
86

97
cd ..
108

11-
cp bazel-bin/libtrtorch.tar.gz dist/
129
cp py/dist/* dist/
1310

1411
pip3 install ipywidgets --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org
@@ -17,5 +14,5 @@ jupyter nbextension enable --py widgetsnbextension
1714
pip3 install timm
1815

1916
# test install
20-
mkdir -p /opt/trtorch && tar xvf dist/libtrtorch.tar.gz --strip-components 2 -C /opt/trtorch --exclude=LICENSE && pip3 uninstall -y trtorch && pip3 install dist/*.whl
17+
mkdir -p /opt/torch_tensorrt && pip3 uninstall -y torch_tensorrt && pip3 install dist/*.whl
2118

0 commit comments

Comments
 (0)