File tree Expand file tree Collapse file tree 2 files changed +53
-4
lines changed
Expand file tree Collapse file tree 2 files changed +53
-4
lines changed Original file line number Diff line number Diff line change 1+ # BUILD redisfab/libtorch-cpu-${ARCH}:$(PT_VER)
2+
3+ # stretch|bionic|buster
4+ ARG OSNICK=buster
5+
6+ # arm32v7|arm64v8
7+ ARG ARCH=aarch64
8+
9+ #----------------------------------------------------------------------------------------------
10+ ARG OS=nvcr.io/nvidia/deepstream-l4t:5.1-21.02-base as builder
11+
12+ FROM ${OS}
13+
14+ ADD ./opt/readies/ /build/readies/
15+ ADD ./opt/build/libtorch/collect.py /build/
16+
17+ ARG PT_VER=1.7.0
18+
19+ RUN apt-get -qq update && apt-get -q install -y git build-essential ninja-build cmake python3.7 python3-pip
20+ RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
21+
22+ RUN apt-get -q install -y python3-cffi python3-numpy
23+ RUN pip3 install setuptools pyyaml typing
24+ # RUN pip3 install mkl mkl-include
25+
26+ RUN git clone --single-branch --branch v${PT_VER} --recursive https://github.com/pytorch/pytorch.git /pytorch
27+
28+ ENV BUILD_PYTHON=0
29+ ENV USE_GLOO=1
30+ ENV USE_OPENCV=0
31+ ENV BUILD_TORCH=ON
32+ ENV BUILD_BINARY=ON
33+ ENV BUILD_CAFFE2_OPS=ON
34+ ENV BUILD_TEST=0
35+ ENV NO_CUDA=1
36+ ENV NO_DISTRIBUTED=1
37+ ENV NO_MKLDNN=1
38+ ENV NO_NNPACK=1
39+ ENV NO_QNNPACK=1
40+
41+ RUN mkdir /pytorch/build_libtorch
42+ WORKDIR /pytorch/build_libtorch
43+ RUN python3 ../tools/build_libtorch.py
44+
45+ ENV BUILD_SHARED_LIBS=OFF
46+ RUN python3 ../tools/build_libtorch.py
47+
48+ WORKDIR /build
49+ RUN ./collect.py --pytorch /pytorch --pytorch-ver ${PT_VER} --dest /pytorch/dest
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ DOCKER_OS.bionic=ubuntu:bionic
2121DOCKER_OS.stretch =debian:stretch-slim
2222DOCKER_OS.buster =debian:buster-slim
2323DOCKER_OS =$(DOCKER_OS.$(OSNICK ) )
24-
24+
2525TAR_ARCH.x64 =x86_64
2626TAR_ARCH.arm64v8 =arm64
2727TAR_ARCH.arm32v7 =arm
@@ -60,9 +60,9 @@ CID_$(1)=$(1)_$(VERSION).cid
6060
6161build_native:
6262 @docker build --iidfile $$(IID_$(1 ) ) -t redisfab/$(STEM ) :$(VERSION ) -$(DEVICE ) -$(1 ) -f Dockerfile.$(VARIANT ) \
63- $(foreach A,$(DOCKER_BUILD_ARGS ) ,--build-arg $(A ) ) .
63+ $(foreach A,$(DOCKER_BUILD_ARGS ) ,--build-arg $(A ) ) $( ROOT )
6464 @docker create --cidfile $$(CID_$(1 ) ) `cat $$(IID_$(1 ) ) `
65- @docker cp `cat $$(CID_$(1 ) ) `:/build /dest/$(STEM ) -$(DEVICE ) -$(OS ) -$(2 ) -$(VERSION ) .tar.gz .
65+ @docker cp `cat $$(CID_$(1 ) ) `:/pytorch /dest/$(STEM ) -$(DEVICE ) -$(OS ) -$(2 ) -$(VERSION ) .tar.gz .
6666
6767.PHONY: build_native
6868endef
@@ -75,7 +75,7 @@ CID_$(1)=$(1)_$(VERSION).cid
7575
7676build_$(1 ) :
7777 @docker build --iidfile $$(IID_$(1 ) ) -t redisfab/$(STEM ) :$(VERSION ) -$(DEVICE ) -$(1 ) -f Dockerfile.$(VARIANT ) \
78- $(foreach A,$(DOCKER_BUILD_ARGS ) ,--build-arg $(A ) ) .
78+ $(foreach A,$(DOCKER_BUILD_ARGS ) ,--build-arg $(A ) ) ../../..
7979 @docker create --cidfile $$(CID_$(1 ) ) `cat $$(IID_$(1 ) ) `
8080 @docker cp `cat $$(CID_$(1 ) ) `:/build/$(STEM ) -$(2 ) -$(VERSION ) .tar.gz .
8181
You can’t perform that action at this time.
0 commit comments