From 33e6ef508b72f5157277162ef7192582b1200882 Mon Sep 17 00:00:00 2001 From: "Chayim I. Kirshen" Date: Mon, 14 Jun 2021 14:30:10 +0300 Subject: [PATCH 01/45] jetson 1.8 --- opt/build/onnxruntime/Dockerfile.jetson | 48 +++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 opt/build/onnxruntime/Dockerfile.jetson diff --git a/opt/build/onnxruntime/Dockerfile.jetson b/opt/build/onnxruntime/Dockerfile.jetson new file mode 100755 index 000000000..eb2df3a48 --- /dev/null +++ b/opt/build/onnxruntime/Dockerfile.jetson @@ -0,0 +1,48 @@ +# BUILD redisfab/onnxruntime-${ARCH}-${OSNICK}:$(ONNXRUNTIME_VER) + +# stretch|bionic|buster +ARG OSNICK=buster + +# arm32v7|arm64v8 +ARG ARCH=jetson + +#---------------------------------------------------------------------------------------------- +ARG OS=nvcr.io/nvidia/deepstream-l4t:5.1-21.02-base as builder + +FROM ${OS} as builder + +ARG ONNXRUNTIME_REPO=https://github.com/microsoft/onnxruntime +ARG ONNXRUNTIME_VER=1.8.0 + +RUN apt-get -qq update +RUN apt-get -qq install -y curl wget tar git patch build-essential \ + build-essential libcurl4-openssl-dev libssl-dev libatlas-base-dev zlib1g-dev \ + python3.6 python3-pip python3-dev python3-numpy +RUN pip3 install --upgrade pip setuptools wheel + +RUN wget -q https://github.com/Kitware/CMake/releases/download/v3.19.7/cmake-3.19.7-Linux-aarch64.tar.gz -O /tmp/cmake.tgz +WORKDIR /tmp +RUN tar -zxpf /tmp/cmake.tgz +RUN mv /tmp/cmake*/bin/* /usr/bin +RUN mv /tmp/cmake-*/share/cmake* /usr/share/ + +RUN rm /usr/bin/python3 +RUN ln -s /usr/bin/python3.6 /usr/bin/python3 + +ENV LANG=en_US.UTF-8 +RUN apt-get install -y locales && \ + sed -i -e "s/# $LANG.*/$LANG UTF-8/" /etc/locale.gen && \ + dpkg-reconfigure --frontend=noninteractive locales && \ + update-locale LANG=$LANG +WORKDIR /build +ARG BUILDTYPE=Release +ARG BUILDARGS="--config ${BUILDTYPE} --parallel" +RUN git clone --single-branch --branch v${ONNXRUNTIME_VER} ${ONNXRUNTIME_REPO} onnxruntime +WORKDIR /build/onnxruntime +RUN git fetch --recurse-submodules +RUN ./build.sh ${BUILDARGS} --update --build +RUN ./build.sh ${BUILDARGS} --build_shared_lib +# RUN ./build.sh ${BUILDARGS} --enable_pybind --build_wheel +ADD ./pack.sh /build +WORKDIR /build +RUN ./pack.sh ${ONNXRUNTIME_VER} ${ARCH} From b101e59076e3c1b109775aeb55988b1116d4d5a1 Mon Sep 17 00:00:00 2001 From: "Chayim I. Kirshen" Date: Tue, 15 Jun 2021 10:17:57 +0300 Subject: [PATCH 02/45] 1.8 in the Makefile --- opt/build/onnxruntime/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opt/build/onnxruntime/Makefile b/opt/build/onnxruntime/Makefile index 1faaabae9..031d069cd 100755 --- a/opt/build/onnxruntime/Makefile +++ b/opt/build/onnxruntime/Makefile @@ -1,7 +1,7 @@ ROOT=. -VERSION ?= 1.7.1 +VERSION ?= 1.8 OSNICK ?= buster #---------------------------------------------------------------------------------------------- From be2a69d5580bb4bf2ca8eb3a317cdf20ee707796 Mon Sep 17 00:00:00 2001 From: "Chayim I. Kirshen" Date: Tue, 15 Jun 2021 14:12:55 +0300 Subject: [PATCH 03/45] starting single use --- opt/build/backends.rules | 29 + opt/build/onnxruntime/.gitignore | 1 + opt/build/onnxruntime/Dockerfile.arm | 53 -- opt/build/onnxruntime/Dockerfile.arm7 | 47 -- opt/build/onnxruntime/Dockerfile.x64 | 45 -- opt/build/onnxruntime/Makefile | 270 ++++--- .../{Dockerfile.jetson => dockerfile.tmpl} | 47 +- opt/build/onnxruntime/ort-0.4.0-werror.patch | 758 ----------------- opt/build/onnxruntime/werror.patch | 759 ------------------ opt/readies | 2 +- 10 files changed, 194 insertions(+), 1817 deletions(-) create mode 100644 opt/build/backends.rules create mode 100644 opt/build/onnxruntime/.gitignore delete mode 100755 opt/build/onnxruntime/Dockerfile.arm delete mode 100755 opt/build/onnxruntime/Dockerfile.arm7 delete mode 100755 opt/build/onnxruntime/Dockerfile.x64 rename opt/build/onnxruntime/{Dockerfile.jetson => dockerfile.tmpl} (61%) delete mode 100755 opt/build/onnxruntime/ort-0.4.0-werror.patch delete mode 100755 opt/build/onnxruntime/werror.patch diff --git a/opt/build/backends.rules b/opt/build/backends.rules new file mode 100644 index 000000000..4a77683aa --- /dev/null +++ b/opt/build/backends.rules @@ -0,0 +1,29 @@ +# default is x64 +ARCH=$(shell ${READIES}/bin/platform --arch) +REDIS_CMAKE_ARCH=x86_64 + +# jetson +ifeq ($(shell test -e /usr/share/doc/nvidia-l4t-jetson-io && echo -n yes),yes) +ARCH=jetson +REDIS_CMAKE_ARCH=aarch64 +else +endif + +export REDIS_CMAKE_ARCH + +DEFAULT_DOCKER_TAG=${DOCKER_ORG}/${PRODUCT}:buildsystem + +build: + REDIS_ARCH=${ARCH} \ + ${READIES}/bin/dockerwrapper \ + -d ${CURDIR}/Dockerfile \ + -t ${DEFAULT_DOCKER_TAG} \ + -e REDIS \ + -g \ + -D "${DOCKER_OPTS}" \ + ${DOCKER_ARGS} +# docker create --cidfile ${PRODUCT}.${ARCH}.cid ${DEFAULT_DOCKER_TAG} +# docker cp `cat $$(CID_$(1))`:/build/$(STEM)-$(1)-$(VERSION).tgz . + +publish: + @aws s3 cp $(STEM)-$(2)-$(VERSION).tgz s3://$(S3_URL)/ --acl public-read diff --git a/opt/build/onnxruntime/.gitignore b/opt/build/onnxruntime/.gitignore new file mode 100644 index 000000000..94143827e --- /dev/null +++ b/opt/build/onnxruntime/.gitignore @@ -0,0 +1 @@ +Dockerfile diff --git a/opt/build/onnxruntime/Dockerfile.arm b/opt/build/onnxruntime/Dockerfile.arm deleted file mode 100755 index 979b3e852..000000000 --- a/opt/build/onnxruntime/Dockerfile.arm +++ /dev/null @@ -1,53 +0,0 @@ -# BUILD redisfab/onnxruntime-${ARCH}-${OSNICK}:$(ONNXRUNTIME_VER) - -# stretch|bionic|buster -ARG OSNICK=buster - -# arm32v7|arm64v8 -ARG ARCH=arm64v8 - -#---------------------------------------------------------------------------------------------- -FROM redisfab/${ARCH}-xbuild:${OSNICK} as builder - -ARG ONNXRUNTIME_REPO=https://github.com/Microsoft/onnxruntime -ARG ONNXRUNTIME_VER=1.0.0 -ARG ARCH_FLAG="--arm64" - -RUN [ "cross-build-start" ] - -RUN apt-get -qq update -RUN apt-get -qq install -y curl wget tar git patch -RUN apt-get -qq install -y build-essential cmake -RUN apt-get -qq install -y libcurl4-openssl-dev libssl-dev libatlas-base-dev zlib1g-dev - -RUN apt-get -q install -y python3 python3-pip python3-dev -RUN pip3 install --upgrade pip setuptools wheel -# RUN pip3 install numpy -RUN apt-get -q install -y python3-numpy - -WORKDIR /build - -ADD ./*.patch /build/ -ADD ./pack.sh /build/ - -ARG BUILDTYPE=MinSizeRel -ARG BUILDARGS="--config ${BUILDTYPE} ${ARCH_FLAG} --parallel" - -RUN set -e ;\ - git clone --single-branch --branch rel-${ONNXRUNTIME_BRANCH} --recursive ${ONNXRUNTIME_REPO} onnxruntime ;\ - cd onnxruntime ;\ - git checkout "rel-${ONNXRUNTIME_VER}" - -RUN set -e ;\ - cd onnxruntime ;\ - patch -p1 -i ../werror.patch - -RUN set -e ;\ - cd onnxruntime ;\ - ./build.sh ${BUILDARGS} --update --build ;\ - ./build.sh ${BUILDARGS} --build_shared_lib -# RUN ./build.sh ${BUILDARGS} --enable_pybind --build_wheel - -RUN ./pack.sh ${ONNXRUNTIME_VER} - -RUN [ "cross-build-end" ] diff --git a/opt/build/onnxruntime/Dockerfile.arm7 b/opt/build/onnxruntime/Dockerfile.arm7 deleted file mode 100755 index 4cfea0af0..000000000 --- a/opt/build/onnxruntime/Dockerfile.arm7 +++ /dev/null @@ -1,47 +0,0 @@ -FROM balenalib/raspberrypi3-python:latest-stretch-build - -ARG ONNXRUNTIME_REPO=https://github.com/Microsoft/onnxruntime -ARG ONNXRUNTIME_BRANCH=rel-1.0.0 -ARG ONNXRUNTIME_VER=1.0.0 -ARG ARCH_FLAG="--arm" -ARG ARCH=arm64v7 - -RUN [ "cross-build-start" ] - -RUN set -e ;\ - apt-get -qq update \; - apt-get -q install -y - git tar wget curl \ - build-essential cmake \ - python3 python3-pip python3-dev \ - libcurl4-openssl-dev libssl-dev libatlas-base-dev - -RUN pip3 install --upgrade pip setuptools wheel -RUN pip3 install numpy - -WORKDIR /build - -ADD ./*.patch /build/ -ADD ./pack.sh /build/ - -ARG BUILDTYPE=MinSizeRel -ARG BUILDARGS="--config ${BUILDTYPE} ${ARM_FLAG} --parallel" - -RUN set -e ;\ - git clone --single-branch --branch ${ONNXRUNTIME_BRANCH} --recursive ${ONNXRUNTIME_REPO} onnxruntime ;\ - cd onnxruntime ;\ - git checkout "rel-${ONNXRUNTIME_VER}" - -RUN set -e ;\ - cd onnxruntime ;\ - patch -p1 -i ../werrror.patch - -RUN set -e ;\ - cd onnxruntime ;\ - ./build.sh ${BUILDARGS} --update --build ;\ - ./build.sh ${BUILDARGS} --build_shared_lib -# RUN ./build.sh ${BUILDARGS} --enable_pybind --build_wheel - -RUN ./pack.sh ${ONNXRUNTIME_VER} - -RUN [ "cross-build-end" ] diff --git a/opt/build/onnxruntime/Dockerfile.x64 b/opt/build/onnxruntime/Dockerfile.x64 deleted file mode 100755 index 8bbff41fb..000000000 --- a/opt/build/onnxruntime/Dockerfile.x64 +++ /dev/null @@ -1,45 +0,0 @@ -# BUILD redisfab/onnxruntime-x64-${OS}:$(ONNXRUNTIME_VER) -ARG OS=ubuntu:16.04 -#---------------------------------------------------------------------------------------------- -FROM ${OS} -ARG ONNXRUNTIME_REPO=https://github.com/RedisAI/onnxruntime -ARG ONNXRUNTIME_VER=1.7.1 -ARG ARCH=x64 - -RUN apt-get -qq update -RUN apt-get install -y software-properties-common -RUN add-apt-repository ppa:deadsnakes/ppa -RUN apt-get -qq update - -RUN apt-get -qq install -y python3.6 curl wget tar git \ - build-essential \ - libcurl4-openssl-dev libssl-dev libatlas-base-dev zlib1g-dev \ - python3 python3-pip python3-dev python3-numpy -RUN wget -q https://github.com/Kitware/CMake/releases/download/v3.19.7/cmake-3.19.7-Linux-x86_64.tar.gz -O /tmp/cmake.tgz -WORKDIR /tmp -RUN tar -zxpf /tmp/cmake.tgz -RUN mv /tmp/cmake*/bin/* /usr/bin -RUN mv /tmp/cmake-*/share/cmake* /usr/share/ - -RUN rm /usr/bin/python3 -RUN ln -s /usr/bin/python3.6 /usr/bin/python3 - -RUN pip3 install --upgrade pip setuptools wheel - -ENV LANG=en_US.UTF-8 -RUN apt-get install -y locales && \ - sed -i -e "s/# $LANG.*/$LANG UTF-8/" /etc/locale.gen && \ - dpkg-reconfigure --frontend=noninteractive locales && \ - update-locale LANG=$LANG -WORKDIR /build -ARG BUILDTYPE=Release -ARG BUILDARGS="--config ${BUILDTYPE} --parallel" -RUN git clone --single-branch --branch rel-${ONNXRUNTIME_VER} ${ONNXRUNTIME_REPO} onnxruntime -WORKDIR /build/onnxruntime -RUN git fetch --recurse-submodules -RUN ./build.sh ${BUILDARGS} --update --build -RUN ./build.sh ${BUILDARGS} --build_shared_lib -# RUN ./build.sh ${BUILDARGS} --enable_pybind --build_wheel -ADD ./pack.sh /build -WORKDIR /build -RUN ./pack.sh ${ONNXRUNTIME_VER} ${ARCH} diff --git a/opt/build/onnxruntime/Makefile b/opt/build/onnxruntime/Makefile index 031d069cd..c9a15bde4 100755 --- a/opt/build/onnxruntime/Makefile +++ b/opt/build/onnxruntime/Makefile @@ -1,134 +1,144 @@ +export REDIS_ONNX_VERSION = 1.8.0 +export REDIS_ONNX_REPO = https://github.com/microsoft/onnxruntime -ROOT=. - -VERSION ?= 1.8 +PRODUCT=onnxruntime +DOCKER_ORG=redislabs OSNICK ?= buster -#---------------------------------------------------------------------------------------------- - -S3_URL=redismodules/onnxruntime - -STEM=onnxruntime-linux - -KEEP ?= 1 - -DOCKER_OS.bionic=ubuntu:bionic -DOCKER_OS.stretch=debian:stretch-slim -DOCKER_OS.buster=debian:buster-slim -DOCKER_OS=$(DOCKER_OS.$(OSNICK)) - -#---------------------------------------------------------------------------------------------- - -define targets # (1=OP, 2=op) -$(1)_TARGETS := -$(1)_TARGETS += $(if $(findstring $(X64),1),$(2)_x64) -$(1)_TARGETS += $(if $(findstring $(ARM7),1),$(2)_arm32v7) -$(1)_TARGETS += $(if $(findstring $(ARM8),1),$(2)_arm64v8) - -$(1)_TARGETS += $$(if $$(strip $$($(1)_TARGETS)),,$(2)_x64 $(2)_arm32v7 $(2)_arm64v8) -endef - -$(eval $(call targets,BUILD,build)) -$(eval $(call targets,PUBLISH,publish)) - -#---------------------------------------------------------------------------------------------- -# arch=x64|arm32v7|arm64v8 -# tar_arch=x86_64|arm|arm64 - -define build_x64 # (1=arch, 2=tar-arch) -IID_$(1)=$(1)_$(VERSION).iid -CID_$(1)=$(1)_$(VERSION).cid - -build_x64: - @docker build --iidfile $$(IID_$(1)) -t redisfab/$(STEM)-x64:$(VERSION) -f Dockerfile.x64 \ - --build-arg OS=$(DOCKER_OS) $(ROOT) - @docker create --cidfile $$(CID_$(1)) `cat $$(IID_$(1))` - @docker cp `cat $$(CID_$(1))`:/build/$(STEM)-x64-$(VERSION).tgz . - -.PHONY: build_x64 -endef - -define build_x64-gpu # (1=arch, 2=tar-arch) -IID_$(1)=$(1)_$(VERSION).iid -CID_$(1)=$(1)_$(VERSION).cid - -build_x64-gpu: - @docker build --iidfile $$(IID_$(1)) -t redisfab/$(STEM)-$(1):$(VERSION) -f Dockerfile.x64-gpu \ - --build-arg OS=$(DOCKER_OS) $(ROOT) - @docker create --cidfile $$(CID_$(1)) `cat $$(IID_$(1))` - @docker cp `cat $$(CID_$(1))`:/build/$(STEM)-$(1)-$(VERSION).tgz . - -.PHONY: build_x64 -endef - -define build_arm # (1=arch, 2=tar-arch) -IID_$(1)=$(1)_$(VERSION).iid -CID_$(1)=$(1)_$(VERSION).cid - -build_$(1): - @docker build --iidfile $$(IID_$(1)) -t redisfab/$(STEM)-$(1):$(VERSION) -f Dockerfile.arm \ - --build-arg ARCH=$(1) --build-arg ARCH_FLAG=--$(2) $(ROOT) - @docker create --cidfile $$(CID_$(1)) `cat $$(IID_$(1))` - @docker cp `cat $$(CID_$(1))`:/build/$(STEM)-$(2)-$(VERSION).tgz . -ifneq ($(KEEP),1) - # @rm $$(IID_$(1)) $$(CID_$(1)) -endif - -.PHONY: build_$(1) -endef - -#---------------------------------------------------------------------------------------------- - -define publish_x64 # (1=arch, 2=tar-arch) -publish_x64: - @aws s3 cp $(STEM)-$(2)-$(VERSION).tgz s3://$(S3_URL)/ --acl public-read - -.PHONY: publish_x64 -endef - -define publish_x64-gpu # (1=arch, 2=tar-arch) -publish_x64-gpu: - @aws s3 cp $(STEM)-$(2)-$(VERSION).tgz s3://$(S3_URL)/ --acl public-read - -.PHONY: publish_x64-gpu -endef - -define publish_arm # (1=arch, 2=tar-arch) -publish_$(1): - @aws s3 cp $(STEM)-$(2)-$(VERSION).tgz s3://$(S3_URL)/ --acl public-read -ifneq ($(KEEP),1) - # @rm $(STEM)-$(2)-$(VERSION).tgz -endif - -.PHONY: publish_$(1) -endef - -#---------------------------------------------------------------------------------------------- - -all: build publish - -build: $(BUILD_TARGETS) - -$(eval $(call build_x64,x64,x86_64)) -$(eval $(call build_x64-gpu,x64-gpu,x86_64-gpu)) -$(eval $(call build_arm,arm64v8,arm64)) -$(eval $(call build_arm,arm32v7,arm)) - -ifneq ($(filter publish,$(MAKECMDGOALS)),) -ifeq ($(wildcard $(HOME)/.aws/credentials),) -$(error Please run 'aws configure' and provide it with access credentials) -endif -endif - -publish: $(PUBLISH_TARGETS) - -$(eval $(call publish_x64,x64,x64)) -$(eval $(call publish_x64-gpu,x64-gpu,x64-gpu)) -$(eval $(call publish_arm,arm64v8,arm64)) -$(eval $(call publish_arm,arm32v7,arm)) - - -help: - @echo "make [build|publish] [X64=1|ARM7=1|ARM8=1]" +ROOT=. -.PHONY: all build publish help +READIES=${ROOT}/../../readies + +include ../backends.rules + +#VERSION ?= 1.8 +#OSNICK ?= buster +# +##---------------------------------------------------------------------------------------------- +# +#S3_URL=redismodules/onnxruntime +# +#STEM=onnxruntime-linux +# +#KEEP ?= 1 +# +#DOCKER_OS.bionic=ubuntu:bionic +#DOCKER_OS.stretch=debian:stretch-slim +#DOCKER_OS.buster=debian:buster-slim +#DOCKER_OS=$(DOCKER_OS.$(OSNICK)) +# +##---------------------------------------------------------------------------------------------- +# +#define targets # (1=OP, 2=op) +#$(1)_TARGETS := +#$(1)_TARGETS += $(if $(findstring $(X64),1),$(2)_x64) +#$(1)_TARGETS += $(if $(findstring $(ARM7),1),$(2)_arm32v7) +#$(1)_TARGETS += $(if $(findstring $(ARM8),1),$(2)_arm64v8) +# +#$(1)_TARGETS += $$(if $$(strip $$($(1)_TARGETS)),,$(2)_x64 $(2)_arm32v7 $(2)_arm64v8) +#endef +# +#$(eval $(call targets,BUILD,build)) +#$(eval $(call targets,PUBLISH,publish)) +# +##---------------------------------------------------------------------------------------------- +## arch=x64|arm32v7|arm64v8 +## tar_arch=x86_64|arm|arm64 +# +#define build_x64 # (1=arch, 2=tar-arch) +#IID_$(1)=$(1)_$(VERSION).iid +#CID_$(1)=$(1)_$(VERSION).cid +# +#build_x64: +# @docker build --iidfile $$(IID_$(1)) -t redisfab/$(STEM)-x64:$(VERSION) -f Dockerfile.x64 \ +# --build-arg OS=$(DOCKER_OS) $(ROOT) +# @docker create --cidfile $$(CID_$(1)) `cat $$(IID_$(1))` +# @docker cp `cat $$(CID_$(1))`:/build/$(STEM)-x64-$(VERSION).tgz . +# +#.PHONY: build_x64 +#endef +# +#define build_x64-gpu # (1=arch, 2=tar-arch) +#IID_$(1)=$(1)_$(VERSION).iid +#CID_$(1)=$(1)_$(VERSION).cid +# +#build_x64-gpu: +# @docker build --iidfile $$(IID_$(1)) -t redisfab/$(STEM)-$(1):$(VERSION) -f Dockerfile.x64-gpu \ +# --build-arg OS=$(DOCKER_OS) $(ROOT) +# @docker create --cidfile $$(CID_$(1)) `cat $$(IID_$(1))` +# @docker cp `cat $$(CID_$(1))`:/build/$(STEM)-$(1)-$(VERSION).tgz . +# +#.PHONY: build_x64 +#endef +# +#define build_arm # (1=arch, 2=tar-arch) +#IID_$(1)=$(1)_$(VERSION).iid +#CID_$(1)=$(1)_$(VERSION).cid +# +#build_$(1): +# @docker build --iidfile $$(IID_$(1)) -t redisfab/$(STEM)-$(1):$(VERSION) -f Dockerfile.arm \ +# --build-arg ARCH=$(1) --build-arg ARCH_FLAG=--$(2) $(ROOT) +# @docker create --cidfile $$(CID_$(1)) `cat $$(IID_$(1))` +# @docker cp `cat $$(CID_$(1))`:/build/$(STEM)-$(2)-$(VERSION).tgz . +#ifneq ($(KEEP),1) +# # @rm $$(IID_$(1)) $$(CID_$(1)) +#endif +# +#.PHONY: build_$(1) +#endef +# +##---------------------------------------------------------------------------------------------- +# +#define publish_x64 # (1=arch, 2=tar-arch) +#publish_x64: +# @aws s3 cp $(STEM)-$(2)-$(VERSION).tgz s3://$(S3_URL)/ --acl public-read +# +#.PHONY: publish_x64 +#endef +# +#define publish_x64-gpu # (1=arch, 2=tar-arch) +#publish_x64-gpu: +# @aws s3 cp $(STEM)-$(2)-$(VERSION).tgz s3://$(S3_URL)/ --acl public-read +# +#.PHONY: publish_x64-gpu +#endef +# +#define publish_arm # (1=arch, 2=tar-arch) +#publish_$(1): +# @aws s3 cp $(STEM)-$(2)-$(VERSION).tgz s3://$(S3_URL)/ --acl public-read +#ifneq ($(KEEP),1) +# # @rm $(STEM)-$(2)-$(VERSION).tgz +#endif +# +#.PHONY: publish_$(1) +#endef +# +##---------------------------------------------------------------------------------------------- +# +#all: build publish +# +#build: $(BUILD_TARGETS) +# +#$(eval $(call build_x64,x64,x86_64)) +#$(eval $(call build_x64-gpu,x64-gpu,x86_64-gpu)) +#$(eval $(call build_arm,arm64v8,arm64)) +#$(eval $(call build_arm,arm32v7,arm)) +# +#ifneq ($(filter publish,$(MAKECMDGOALS)),) +#ifeq ($(wildcard $(HOME)/.aws/credentials),) +#$(error Please run 'aws configure' and provide it with access credentials) +#endif +#endif +# +#publish: $(PUBLISH_TARGETS) +# +#$(eval $(call publish_x64,x64,x64)) +#$(eval $(call publish_x64-gpu,x64-gpu,x64-gpu)) +#$(eval $(call publish_arm,arm64v8,arm64)) +#$(eval $(call publish_arm,arm32v7,arm)) +# +# +#help: +# @echo "make [build|publish] [X64=1|ARM7=1|ARM8=1]" +# +#.PHONY: all build publish help diff --git a/opt/build/onnxruntime/Dockerfile.jetson b/opt/build/onnxruntime/dockerfile.tmpl similarity index 61% rename from opt/build/onnxruntime/Dockerfile.jetson rename to opt/build/onnxruntime/dockerfile.tmpl index eb2df3a48..cf9eca012 100755 --- a/opt/build/onnxruntime/Dockerfile.jetson +++ b/opt/build/onnxruntime/dockerfile.tmpl @@ -1,39 +1,37 @@ -# BUILD redisfab/onnxruntime-${ARCH}-${OSNICK}:$(ONNXRUNTIME_VER) - -# stretch|bionic|buster -ARG OSNICK=buster - -# arm32v7|arm64v8 -ARG ARCH=jetson - #---------------------------------------------------------------------------------------------- -ARG OS=nvcr.io/nvidia/deepstream-l4t:5.1-21.02-base as builder +{% if REDIS_ARCH == 'x64' %} +FROM ubuntu:bionic +{% elif REDIS_ARCH == 'jetson' %} +FROM nvcr.io/nvidia/deepstream-l4t:5.1-21.02-base +{% endif %} -FROM ${OS} as builder - -ARG ONNXRUNTIME_REPO=https://github.com/microsoft/onnxruntime -ARG ONNXRUNTIME_VER=1.8.0 +ARG ONNXRUNTIME_REPO={{REDIS_ONNX_REPO}} +ARG ONNXRUNTIME_VER={{REDIS_ONNX_VERSION}} RUN apt-get -qq update -RUN apt-get -qq install -y curl wget tar git patch build-essential \ +RUN DEBIAN_NONINTERACTIVE=1 apt-get install -y curl wget tar git patch \ build-essential libcurl4-openssl-dev libssl-dev libatlas-base-dev zlib1g-dev \ - python3.6 python3-pip python3-dev python3-numpy -RUN pip3 install --upgrade pip setuptools wheel - -RUN wget -q https://github.com/Kitware/CMake/releases/download/v3.19.7/cmake-3.19.7-Linux-aarch64.tar.gz -O /tmp/cmake.tgz -WORKDIR /tmp -RUN tar -zxpf /tmp/cmake.tgz -RUN mv /tmp/cmake*/bin/* /usr/bin -RUN mv /tmp/cmake-*/share/cmake* /usr/share/ + python3.6 python3-pip python3-dev python3-numpy RUN rm /usr/bin/python3 RUN ln -s /usr/bin/python3.6 /usr/bin/python3 +RUN python3 -m pip install --upgrade pip setuptools wheel ENV LANG=en_US.UTF-8 RUN apt-get install -y locales && \ sed -i -e "s/# $LANG.*/$LANG UTF-8/" /etc/locale.gen && \ dpkg-reconfigure --frontend=noninteractive locales && \ update-locale LANG=$LANG + +{% set cmake_version = "3.19.7" %} +RUN wget -q https://github.com/Kitware/CMake/releases/download/v{{cmake_version}}/cmake-{{cmake_version}}-Linux-{{REDIS_CMAKE_ARCH}}.tar.gz -O /tmp/cmake.tgz + +WORKDIR /tmp +RUN tar -zxpf /tmp/cmake.tgz +RUN mv /tmp/cmake*/bin/* /usr/bin +RUN mv /tmp/cmake-*/share/cmake* /usr/share/ + +# build WORKDIR /build ARG BUILDTYPE=Release ARG BUILDARGS="--config ${BUILDTYPE} --parallel" @@ -42,7 +40,8 @@ WORKDIR /build/onnxruntime RUN git fetch --recurse-submodules RUN ./build.sh ${BUILDARGS} --update --build RUN ./build.sh ${BUILDARGS} --build_shared_lib -# RUN ./build.sh ${BUILDARGS} --enable_pybind --build_wheel + +# package ADD ./pack.sh /build WORKDIR /build -RUN ./pack.sh ${ONNXRUNTIME_VER} ${ARCH} +RUN ./pack.sh {{REDIS_ONNX_VERSION}} {{REDIS_ARCH}} diff --git a/opt/build/onnxruntime/ort-0.4.0-werror.patch b/opt/build/onnxruntime/ort-0.4.0-werror.patch deleted file mode 100755 index be5eb10b7..000000000 --- a/opt/build/onnxruntime/ort-0.4.0-werror.patch +++ /dev/null @@ -1,758 +0,0 @@ -diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt -index 96c89fe..f59edea 100644 ---- a/cmake/CMakeLists.txt -+++ b/cmake/CMakeLists.txt -@@ -411,8 +411,8 @@ else() - - if(onnxruntime_DEV_MODE) - if(NOT onnxruntime_USE_TVM) -- string(APPEND CMAKE_CXX_FLAGS " -Werror") -- string(APPEND CMAKE_C_FLAGS " -Werror") -+# string(APPEND CMAKE_CXX_FLAGS " -Werror") -+# string(APPEND CMAKE_C_FLAGS " -Werror") - endif() - endif() - check_cxx_compiler_flag(-Wunused-but-set-variable HAS_UNUSED_BUT_SET_VARIABLE) -Submodule cmake/external/eigen contains modified content -diff --git a/cmake/external/eigen/CMakeLists.txt b/cmake/external/eigen/CMakeLists.txt -index 76e083314..a515736cd 100644 ---- a/cmake/external/eigen/CMakeLists.txt -+++ b/cmake/external/eigen/CMakeLists.txt -@@ -151,10 +151,10 @@ if(NOT MSVC) - - # clang outputs some warnings for unknown flags that are not caught by check_cxx_compiler_flag - # adding -Werror turns such warnings into errors -- check_cxx_compiler_flag("-Werror" COMPILER_SUPPORT_WERROR) -- if(COMPILER_SUPPORT_WERROR) -- set(CMAKE_REQUIRED_FLAGS "-Werror") -- endif() -+# check_cxx_compiler_flag("-Werror" COMPILER_SUPPORT_WERROR) -+# if(COMPILER_SUPPORT_WERROR) -+# set(CMAKE_REQUIRED_FLAGS "-Werror") -+# endif() - ei_add_cxx_compiler_flag("-pedantic") - ei_add_cxx_compiler_flag("-Wall") - ei_add_cxx_compiler_flag("-Wextra") -Submodule cmake/external/googletest contains modified content -diff --git a/cmake/external/googletest/googletest/cmake/internal_utils.cmake b/cmake/external/googletest/googletest/cmake/internal_utils.cmake -index 6448918f..38e1a864 100644 ---- a/cmake/external/googletest/googletest/cmake/internal_utils.cmake -+++ b/cmake/external/googletest/googletest/cmake/internal_utils.cmake -@@ -94,7 +94,7 @@ macro(config_compiler_and_linker) - set(cxx_no_exception_flags "-EHs-c- -D_HAS_EXCEPTIONS=0") - set(cxx_no_rtti_flags "-GR-") - elseif (CMAKE_COMPILER_IS_GNUCXX) -- set(cxx_base_flags "-Wall -Wshadow -Werror") -+ set(cxx_base_flags "-Wall -Wshadow") - if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0.0) - set(cxx_base_flags "${cxx_base_flags} -Wno-error=dangling-else") - endif() -diff --git a/cmake/external/googletest/googletest/xcode/Config/General.xcconfig b/cmake/external/googletest/googletest/xcode/Config/General.xcconfig -index f23e3222..ac07337f 100644 ---- a/cmake/external/googletest/googletest/xcode/Config/General.xcconfig -+++ b/cmake/external/googletest/googletest/xcode/Config/General.xcconfig -@@ -17,7 +17,7 @@ ZERO_LINK = NO - PREBINDING = NO - - // Strictest warning policy --WARNING_CFLAGS = -Wall -Werror -Wendif-labels -Wnewline-eof -Wno-sign-compare -Wshadow -+WARNING_CFLAGS = -Wall -Wendif-labels -Wnewline-eof -Wno-sign-compare -Wshadow - - // Work around Xcode bugs by using external strip. See: - // http://lists.apple.com/archives/Xcode-users/2006/Feb/msg00050.html -Submodule cmake/external/gsl contains modified content -diff --git a/cmake/external/gsl/tests/CMakeLists.txt b/cmake/external/gsl/tests/CMakeLists.txt -index 0e08d77..a4d103d 100644 ---- a/cmake/external/gsl/tests/CMakeLists.txt -+++ b/cmake/external/gsl/tests/CMakeLists.txt -@@ -41,7 +41,7 @@ target_compile_options(gsl_tests_config INTERFACE - -Wcast-align - -Wconversion - -Wctor-dtor-privacy -- -Werror -+# -Werror - -Wextra - -Wno-missing-braces - -Wnon-virtual-dtor -@@ -129,7 +129,7 @@ target_compile_options(gsl_tests_config_noexcept INTERFACE - -Wcast-align - -Wconversion - -Wctor-dtor-privacy -- -Werror -+# -Werror - -Wextra - -Wno-missing-braces - -Wnon-virtual-dtor -Submodule cmake/external/nsync contains modified content -diff --git a/cmake/external/nsync/builds/aarch64.linux.c++11/Makefile b/cmake/external/nsync/builds/aarch64.linux.c++11/Makefile -index d7b138b..d76d43f 100644 ---- a/cmake/external/nsync/builds/aarch64.linux.c++11/Makefile -+++ b/cmake/external/nsync/builds/aarch64.linux.c++11/Makefile -@@ -2,7 +2,7 @@ - # use futex directly. - CC=g++ - PLATFORM_CPPFLAGS=-DNSYNC_USE_CPP11_TIMEPOINT -DNSYNC_ATOMIC_CPP11 -I../../platform/c++11.futex -I../../platform/c++11 -I../../platform/gcc -I../../platform/posix -pthread --PLATFORM_CFLAGS=-std=c++11 -Werror -Wall -Wextra -pedantic -+PLATFORM_CFLAGS=-std=c++11 -Wall -Wextra -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M -std=c++11 - PLATFORM_C=../../platform/linux/src/nsync_semaphore_futex.c ../../platform/c++11/src/per_thread_waiter.cc ../../platform/c++11/src/yield.cc ../../platform/c++11/src/time_rep_timespec.cc ../../platform/c++11/src/nsync_panic.cc -diff --git a/cmake/external/nsync/builds/aarch64.linux.clang/Makefile b/cmake/external/nsync/builds/aarch64.linux.clang/Makefile -index 291b3db..961aea1 100644 ---- a/cmake/external/nsync/builds/aarch64.linux.clang/Makefile -+++ b/cmake/external/nsync/builds/aarch64.linux.clang/Makefile -@@ -1,6 +1,6 @@ - CC=clang - PLATFORM_CPPFLAGS=-D_POSIX_C_SOURCE=200809L -I../../platform/clang -I../../platform/linux -I../../platform/aarch64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -Wno-unneeded-internal-declaration -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic -Wno-unneeded-internal-declaration - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/linux/src/nsync_semaphore_futex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/aarch64.linux.g++/Makefile b/cmake/external/nsync/builds/aarch64.linux.g++/Makefile -index d4f0528..d1e2f24 100644 ---- a/cmake/external/nsync/builds/aarch64.linux.g++/Makefile -+++ b/cmake/external/nsync/builds/aarch64.linux.g++/Makefile -@@ -1,6 +1,6 @@ - CC=g++ - PLATFORM_CPPFLAGS=-DNSYNC_ATOMIC_CPP11 -I../../platform/linux -I../../platform/c++11 -D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/aarch64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-x c++ -std=c++11 -Werror -Wall -Wextra -pedantic -+PLATFORM_CFLAGS=-x c++ -std=c++11 -Wall -Wextra -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M -x c++ -std=c++11 - PLATFORM_C=../../platform/linux/src/nsync_semaphore_futex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/aarch64.linux.gcc.atm-asm/Makefile b/cmake/external/nsync/builds/aarch64.linux.gcc.atm-asm/Makefile -index d5e168e..3218ce0 100644 ---- a/cmake/external/nsync/builds/aarch64.linux.gcc.atm-asm/Makefile -+++ b/cmake/external/nsync/builds/aarch64.linux.gcc.atm-asm/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-I../../platform/atomic_ind -D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/linux -I../../platform/aarch64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/linux/src/nsync_semaphore_futex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/aarch64.linux.gcc.atm-c++11/Makefile b/cmake/external/nsync/builds/aarch64.linux.gcc.atm-c++11/Makefile -index 6251fed..238dd54 100644 ---- a/cmake/external/nsync/builds/aarch64.linux.gcc.atm-c++11/Makefile -+++ b/cmake/external/nsync/builds/aarch64.linux.gcc.atm-c++11/Makefile -@@ -1,7 +1,7 @@ - PLATFORM_CPPFLAGS=-I../../platform/atomic_ind -D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/linux -I../../platform/aarch64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread --PLATFORM_CXXFLAGS=-Werror -Wall -Wextra -std=c++11 -pedantic -+PLATFORM_CXXFLAGS=-Wall -Wextra -std=c++11 -pedantic - PLATFORM_CXX=../../platform/c_from_c++11/src/nsync_atm_c++.cc - MKDEP_DEPEND=mkdep - MKDEP=./mkdep ${CC} -E -c++=-std=c++11 -diff --git a/cmake/external/nsync/builds/aarch64.linux.gcc.atm-c11/Makefile b/cmake/external/nsync/builds/aarch64.linux.gcc.atm-c11/Makefile -index 10d1104..21a2f43 100644 ---- a/cmake/external/nsync/builds/aarch64.linux.gcc.atm-c11/Makefile -+++ b/cmake/external/nsync/builds/aarch64.linux.gcc.atm-c11/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-DNSYNC_ATOMIC_C11 -I../../platform/c11 -D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/linux -I../../platform/aarch64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/linux/src/nsync_semaphore_futex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/aarch64.linux.gcc.sem-mutex/Makefile b/cmake/external/nsync/builds/aarch64.linux.gcc.sem-mutex/Makefile -index 5352904..a428b34 100644 ---- a/cmake/external/nsync/builds/aarch64.linux.gcc.sem-mutex/Makefile -+++ b/cmake/external/nsync/builds/aarch64.linux.gcc.sem-mutex/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/linux -I../../platform/aarch64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/posix/src/nsync_semaphore_mutex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/aarch64.linux.gcc.sem-sem_t/Makefile b/cmake/external/nsync/builds/aarch64.linux.gcc.sem-sem_t/Makefile -index 79a4f6d..c642bde 100644 ---- a/cmake/external/nsync/builds/aarch64.linux.gcc.sem-sem_t/Makefile -+++ b/cmake/external/nsync/builds/aarch64.linux.gcc.sem-sem_t/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/linux -I../../platform/aarch64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/posix/src/nsync_semaphore_sem_t.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/aarch64.linux.gcc/Makefile b/cmake/external/nsync/builds/aarch64.linux.gcc/Makefile -index 7dbeb25..487fc55 100644 ---- a/cmake/external/nsync/builds/aarch64.linux.gcc/Makefile -+++ b/cmake/external/nsync/builds/aarch64.linux.gcc/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/linux -I../../platform/aarch64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/linux/src/nsync_semaphore_futex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/arm.linux.gcc.atm-asm.lrt/Makefile b/cmake/external/nsync/builds/arm.linux.gcc.atm-asm.lrt/Makefile -index 3cd81a1..bb88607 100644 ---- a/cmake/external/nsync/builds/arm.linux.gcc.atm-asm.lrt/Makefile -+++ b/cmake/external/nsync/builds/arm.linux.gcc.atm-asm.lrt/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-I../../platform/atomic_ind -D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/linux -I../../platform/arm -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread - PLATFORM_LIBS=-lrt - MKDEP=${CC} -M -diff --git a/cmake/external/nsync/builds/arm.linux.gcc.lrt/Makefile b/cmake/external/nsync/builds/arm.linux.gcc.lrt/Makefile -index 009cd01..f058b7f 100644 ---- a/cmake/external/nsync/builds/arm.linux.gcc.lrt/Makefile -+++ b/cmake/external/nsync/builds/arm.linux.gcc.lrt/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/linux -I../../platform/arm -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread - PLATFORM_LIBS=-lrt - MKDEP=${CC} -M -diff --git a/cmake/external/nsync/builds/x86_64.linux.c++11/Makefile b/cmake/external/nsync/builds/x86_64.linux.c++11/Makefile -index d7b138b..d76d43f 100644 ---- a/cmake/external/nsync/builds/x86_64.linux.c++11/Makefile -+++ b/cmake/external/nsync/builds/x86_64.linux.c++11/Makefile -@@ -2,7 +2,7 @@ - # use futex directly. - CC=g++ - PLATFORM_CPPFLAGS=-DNSYNC_USE_CPP11_TIMEPOINT -DNSYNC_ATOMIC_CPP11 -I../../platform/c++11.futex -I../../platform/c++11 -I../../platform/gcc -I../../platform/posix -pthread --PLATFORM_CFLAGS=-std=c++11 -Werror -Wall -Wextra -pedantic -+PLATFORM_CFLAGS=-std=c++11 -Wall -Wextra -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M -std=c++11 - PLATFORM_C=../../platform/linux/src/nsync_semaphore_futex.c ../../platform/c++11/src/per_thread_waiter.cc ../../platform/c++11/src/yield.cc ../../platform/c++11/src/time_rep_timespec.cc ../../platform/c++11/src/nsync_panic.cc -diff --git a/cmake/external/nsync/builds/x86_64.linux.clang/Makefile b/cmake/external/nsync/builds/x86_64.linux.clang/Makefile -index dc16f1f..dfa2bfb 100644 ---- a/cmake/external/nsync/builds/x86_64.linux.clang/Makefile -+++ b/cmake/external/nsync/builds/x86_64.linux.clang/Makefile -@@ -1,6 +1,6 @@ - CC=clang - PLATFORM_CPPFLAGS=-D_POSIX_C_SOURCE=200809L -I../../platform/clang -I../../platform/linux -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -Wno-unneeded-internal-declaration -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic -Wno-unneeded-internal-declaration - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/linux/src/nsync_semaphore_futex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/x86_64.linux.g++/Makefile b/cmake/external/nsync/builds/x86_64.linux.g++/Makefile -index 990e1e4..a55a5db 100644 ---- a/cmake/external/nsync/builds/x86_64.linux.g++/Makefile -+++ b/cmake/external/nsync/builds/x86_64.linux.g++/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-DNSYNC_ATOMIC_CPP11 -I../../platform/linux -I../../platform/c++11 -D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-x c++ -std=c++11 -Werror -Wall -Wextra -pedantic -+PLATFORM_CFLAGS=-x c++ -std=c++11 -Wall -Wextra -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M -x c++ -std=c++11 - PLATFORM_C=../../platform/linux/src/nsync_semaphore_futex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/x86_64.linux.gcc.atm-asm/Makefile b/cmake/external/nsync/builds/x86_64.linux.gcc.atm-asm/Makefile -index 870772e..26df437 100644 ---- a/cmake/external/nsync/builds/x86_64.linux.gcc.atm-asm/Makefile -+++ b/cmake/external/nsync/builds/x86_64.linux.gcc.atm-asm/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-I../../platform/atomic_ind -D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/linux -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/linux/src/nsync_semaphore_futex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/x86_64.linux.gcc.atm-c++11/Makefile b/cmake/external/nsync/builds/x86_64.linux.gcc.atm-c++11/Makefile -index 6dad2b7..e98d035 100644 ---- a/cmake/external/nsync/builds/x86_64.linux.gcc.atm-c++11/Makefile -+++ b/cmake/external/nsync/builds/x86_64.linux.gcc.atm-c++11/Makefile -@@ -1,7 +1,7 @@ - PLATFORM_CPPFLAGS=-I../../platform/atomic_ind -D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/linux -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread --PLATFORM_CXXFLAGS=-Werror -Wall -Wextra -std=c++11 -pedantic -+PLATFORM_CXXFLAGS=-Wall -Wextra -std=c++11 -pedantic - PLATFORM_CXX=../../platform/c_from_c++11/src/nsync_atm_c++.cc - MKDEP_DEPEND=mkdep - MKDEP=./mkdep ${CC} -E -c++=-std=c++11 -diff --git a/cmake/external/nsync/builds/x86_64.linux.gcc.atm-c11/Makefile b/cmake/external/nsync/builds/x86_64.linux.gcc.atm-c11/Makefile -index a7c98a1..395e8c9 100644 ---- a/cmake/external/nsync/builds/x86_64.linux.gcc.atm-c11/Makefile -+++ b/cmake/external/nsync/builds/x86_64.linux.gcc.atm-c11/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-DNSYNC_ATOMIC_C11 -I../../platform/c11 -D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/linux -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -Wno-unneeded-internal-declaration -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic -Wno-unneeded-internal-declaration - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/linux/src/nsync_semaphore_futex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/x86_64.linux.gcc.sem-mutex/Makefile b/cmake/external/nsync/builds/x86_64.linux.gcc.sem-mutex/Makefile -index 035c19f..3ba36e3 100644 ---- a/cmake/external/nsync/builds/x86_64.linux.gcc.sem-mutex/Makefile -+++ b/cmake/external/nsync/builds/x86_64.linux.gcc.sem-mutex/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/linux -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/posix/src/nsync_semaphore_mutex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/x86_64.linux.gcc.sem-sem_t/Makefile b/cmake/external/nsync/builds/x86_64.linux.gcc.sem-sem_t/Makefile -index 040611c..394abf7 100644 ---- a/cmake/external/nsync/builds/x86_64.linux.gcc.sem-sem_t/Makefile -+++ b/cmake/external/nsync/builds/x86_64.linux.gcc.sem-sem_t/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/linux -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/posix/src/nsync_semaphore_sem_t.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/x86_64.linux.gcc/Makefile b/cmake/external/nsync/builds/x86_64.linux.gcc/Makefile -index 4bfa290..0174802 100644 ---- a/cmake/external/nsync/builds/x86_64.linux.gcc/Makefile -+++ b/cmake/external/nsync/builds/x86_64.linux.gcc/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/linux -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/linux/src/nsync_semaphore_futex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/x86_64.linux.old_gcc/Makefile b/cmake/external/nsync/builds/x86_64.linux.old_gcc/Makefile -index 347c2ce..6e70f0f 100644 ---- a/cmake/external/nsync/builds/x86_64.linux.old_gcc/Makefile -+++ b/cmake/external/nsync/builds/x86_64.linux.old_gcc/Makefile -@@ -1,6 +1,6 @@ - # Force the use of old gcc atomics. - PLATFORM_CPPFLAGS=-D_POSIX_C_SOURCE=200809L -I../../platform/gcc_old -I../../platform/gcc -I../../platform/linux -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/linux/src/nsync_semaphore_futex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/x86_64.linux.tcc/Makefile b/cmake/external/nsync/builds/x86_64.linux.tcc/Makefile -index 732265f..f986e91 100644 ---- a/cmake/external/nsync/builds/x86_64.linux.tcc/Makefile -+++ b/cmake/external/nsync/builds/x86_64.linux.tcc/Makefile -@@ -1,6 +1,6 @@ - CC=tcc - PLATFORM_CPPFLAGS=-I../../platform/atomic_ind -D_POSIX_C_SOURCE=200809L -I../../platform/tcc -I../../platform/linux -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -+PLATFORM_CFLAGS=-Wall - PLATFORM_LDFLAGS=-pthread - MKDEP_DEPEND=mkdep - MKDEP=./mkdep ${CC} -E -diff --git a/cmake/external/nsync/builds/x86_64.macos.c++11/Makefile b/cmake/external/nsync/builds/x86_64.macos.c++11/Makefile -index 4142416..2b552ae 100644 ---- a/cmake/external/nsync/builds/x86_64.macos.c++11/Makefile -+++ b/cmake/external/nsync/builds/x86_64.macos.c++11/Makefile -@@ -1,7 +1,7 @@ - CC=clang++ - # Some versions of MacOS (such as Sierra) require _DARWIN_C_SOURCE to include , , and (!) - PLATFORM_CPPFLAGS=-DNSYNC_USE_CPP11_TIMEPOINT -DNSYNC_ATOMIC_CPP11 -D_DARWIN_C_SOURCE -I../../platform/c++11 -I../../platform/gcc -I../../platform/macos -I../../platform/posix -pthread --PLATFORM_CFLAGS=-x c++ -std=c++11 -Werror -Wall -Wextra -pedantic -+PLATFORM_CFLAGS=-x c++ -std=c++11 -Wall -Wextra -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -x c++ -M -std=c++11 - # Currently, MacOS's C++11 implementation is incomplete, and does not support -diff --git a/cmake/external/nsync/builds/x86_64.macos.clang.atm-c++11/Makefile b/cmake/external/nsync/builds/x86_64.macos.clang.atm-c++11/Makefile -index bf15b64..1122bb1 100644 ---- a/cmake/external/nsync/builds/x86_64.macos.clang.atm-c++11/Makefile -+++ b/cmake/external/nsync/builds/x86_64.macos.clang.atm-c++11/Makefile -@@ -1,7 +1,7 @@ - PLATFORM_CPPFLAGS=-I../../platform/atomic_ind -D_POSIX_C_SOURCE=200809L -I../../platform/clang -I../../platform/macos -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -Wno-unneeded-internal-declaration -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic -Wno-unneeded-internal-declaration - PLATFORM_LDFLAGS=-pthread --PLATFORM_CXXFLAGS=-Werror -Wall -Wextra -std=c++11 -pedantic -+PLATFORM_CXXFLAGS=-Wall -Wextra -std=c++11 -pedantic - PLATFORM_CXX=../../platform/c_from_c++11/src/nsync_atm_c++.cc - MKDEP_DEPEND=mkdep - MKDEP=./mkdep ${CC} -E -c++=-std=c++11 -diff --git a/cmake/external/nsync/builds/x86_64.macos.clang.atm-c11/Makefile b/cmake/external/nsync/builds/x86_64.macos.clang.atm-c11/Makefile -index 653f99a..eb925bb 100644 ---- a/cmake/external/nsync/builds/x86_64.macos.clang.atm-c11/Makefile -+++ b/cmake/external/nsync/builds/x86_64.macos.clang.atm-c11/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-D_POSIX_C_SOURCE=200809L -DNSYNC_ATOMIC_C11 -I../../platform/c11 -I../../platform/macos -I../../platform/clang -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -Wno-unneeded-internal-declaration -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic -Wno-unneeded-internal-declaration - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/posix/src/clock_gettime.c ../../platform/posix/src/nsync_semaphore_mutex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/x86_64.macos.clang.atm-os/Makefile b/cmake/external/nsync/builds/x86_64.macos.clang.atm-os/Makefile -index 04943e3..cf8fc7f 100644 ---- a/cmake/external/nsync/builds/x86_64.macos.clang.atm-os/Makefile -+++ b/cmake/external/nsync/builds/x86_64.macos.clang.atm-os/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-D_POSIX_C_SOURCE=200809L -I../../platform/macos -I../../platform/clang -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -Wno-unneeded-internal-declaration -Wno-deprecated-declarations -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic -Wno-unneeded-internal-declaration -Wno-deprecated-declarations - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/posix/src/clock_gettime.c ../../platform/posix/src/nsync_semaphore_mutex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/x86_64.macos.clang/Makefile b/cmake/external/nsync/builds/x86_64.macos.clang/Makefile -index 2b36b8d..c02e528 100644 ---- a/cmake/external/nsync/builds/x86_64.macos.clang/Makefile -+++ b/cmake/external/nsync/builds/x86_64.macos.clang/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-D_POSIX_C_SOURCE=200809L -I../../platform/clang -I../../platform/macos -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -Wno-unneeded-internal-declaration -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic -Wno-unneeded-internal-declaration - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/posix/src/clock_gettime.c ../../platform/posix/src/nsync_semaphore_mutex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/x86_64.netbsd.gcc.atm-asm/Makefile b/cmake/external/nsync/builds/x86_64.netbsd.gcc.atm-asm/Makefile -index adce5dc..e90f92e 100644 ---- a/cmake/external/nsync/builds/x86_64.netbsd.gcc.atm-asm/Makefile -+++ b/cmake/external/nsync/builds/x86_64.netbsd.gcc.atm-asm/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-I../../platform/atomic_ind -D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/netbsd -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/posix/src/nsync_semaphore_mutex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/x86_64.netbsd.gcc/Makefile b/cmake/external/nsync/builds/x86_64.netbsd.gcc/Makefile -index d8d7247..aa46d8e 100644 ---- a/cmake/external/nsync/builds/x86_64.netbsd.gcc/Makefile -+++ b/cmake/external/nsync/builds/x86_64.netbsd.gcc/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/netbsd -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/posix/src/nsync_semaphore_mutex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/x86_64.openbsd.gcc/Makefile b/cmake/external/nsync/builds/x86_64.openbsd.gcc/Makefile -index 8d9b035..ded5309 100644 ---- a/cmake/external/nsync/builds/x86_64.openbsd.gcc/Makefile -+++ b/cmake/external/nsync/builds/x86_64.openbsd.gcc/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-D_POSIX_C_SOURCE=200809L -I../../platform/gcc_no_tls -I../../platform/gcc -I../../platform/openbsd -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/posix/src/nsync_semaphore_mutex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/tools/mkmakefile.sh b/cmake/external/nsync/tools/mkmakefile.sh -index 365b34b..962962a 100644 ---- a/cmake/external/nsync/tools/mkmakefile.sh -+++ b/cmake/external/nsync/tools/mkmakefile.sh -@@ -281,11 +281,11 @@ makefile=` - esac - case "$cc_type.$cplusplus" in - gcc.) echo "PLATFORM_CPPFLAGS=$atomic_ind$cppflags" -- echo "PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic" -+ echo "PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic" - case "$ldflags" in ?*) echo "PLATFORM_LDFLAGS=$ldflags";; esac - case "$libs" in ?*) echo "PLATFORM_LIBS=$libs";; esac - case "$atomics" in -- c++11) echo "PLATFORM_CXXFLAGS=-Werror -Wall -Wextra -std=c++11 -pedantic" -+ c++11) echo "PLATFORM_CXXFLAGS=-Wall -Wextra -std=c++11 -pedantic" - echo "PLATFORM_CXX=../../platform/c_from_c++11/src/nsync_atm_c++.cc" - echo "MKDEP_DEPEND=mkdep" - echo 'MKDEP=./mkdep ${CC} -E -c++=-std=c++11' -@@ -299,11 +299,11 @@ makefile=` - echo "TEST_PLATFORM_OBJS=$test_platform_o" - ;; - clang.) echo "PLATFORM_CPPFLAGS=$atomic_ind$cppflags" -- echo "PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -Wno-unneeded-internal-declaration" -+ echo "PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic -Wno-unneeded-internal-declaration" - case "$ldflags" in ?*) echo "PLATFORM_LDFLAGS=$ldflags";; esac - case "$libs" in ?*) echo "PLATFORM_LIBS=$libs";; esac - case "$atomics" in -- c++11) echo "PLATFORM_CXXFLAGS=-Werror -Wall -Wextra -std=c++11 -pedantic" -+ c++11) echo "PLATFORM_CXXFLAGS=-Wall -Wextra -std=c++11 -pedantic" - echo "PLATFORM_CXX=../../platform/c_from_c++11/src/nsync_atm_c++.cc" - echo "MKDEP_DEPEND=mkdep" - echo 'MKDEP=./mkdep ${CC} -E -c++=-std=c++11' -@@ -317,7 +317,7 @@ makefile=` - echo "TEST_PLATFORM_OBJS=$test_platform_o" - ;; - gcc.c++) echo "PLATFORM_CPPFLAGS=-DNSYNC_ATOMIC_CPP11 -I../../platform/c++11 $cppflags" -- echo "PLATFORM_CFLAGS=-x c++ -std=c++11 -Werror -Wall -Wextra -pedantic" -+ echo "PLATFORM_CFLAGS=-x c++ -std=c++11 -Wall -Wextra -pedantic" - case "$ldflags" in ?*) echo "PLATFORM_LDFLAGS=$ldflags";; esac - case "$libs" in ?*) echo "PLATFORM_LIBS=$libs";; esac - echo 'MKDEP=${CC} -M -x c++ -std=c++11' -@@ -328,7 +328,7 @@ makefile=` - echo "TEST_PLATFORM_OBJS=$test_platform_o" - ;; - clang.c++) echo "PLATFORM_CPPFLAGS=-DNSYNC_ATOMIC_CPP11 -I../../platform/c++11 $cppflags" -- echo "PLATFORM_CFLAGS=-x c++ -std=c++11 -Werror -Wall -Wextra -pedantic -Wno-unneeded-internal-declaration" -+ echo "PLATFORM_CFLAGS=-x c++ -std=c++11 -Wall -Wextra -pedantic -Wno-unneeded-internal-declaration" - case "$ldflags" in ?*) echo "PLATFORM_LDFLAGS=$ldflags";; esac - case "$libs" in ?*) echo "PLATFORM_LIBS=$libs";; esac - echo 'MKDEP=${CC} -M -x c++ -std=c++11' -@@ -339,7 +339,7 @@ makefile=` - echo "TEST_PLATFORM_OBJS=$test_platform_o" - ;; - tcc.) echo "PLATFORM_CPPFLAGS=$atomic_ind$cppflags" -- echo "PLATFORM_CFLAGS=-Werror -Wall" -+ echo "PLATFORM_CFLAGS=-Wall" - case "$ldflags" in ?*) echo "PLATFORM_LDFLAGS=$ldflags";; esac - case "$libs" in ?*) echo "PLATFORM_LIBS=$libs";; esac - echo "MKDEP_DEPEND=mkdep" -Submodule cmake/external/onnx contains modified content -diff --git a/cmake/external/onnx/CMakeLists.txt b/cmake/external/onnx/CMakeLists.txt -index 195b0486..1c903bdf 100644 ---- a/cmake/external/onnx/CMakeLists.txt -+++ b/cmake/external/onnx/CMakeLists.txt -@@ -485,7 +485,7 @@ elseif(APPLE) - else() - target_compile_options(onnx PRIVATE -Wall -Wextra) - if(${ONNX_WERROR}) -- target_compile_options(onnx PRIVATE -Werror) -+# target_compile_options(onnx PRIVATE -Werror) - endif() - endif() - -Submodule third_party/benchmark contains modified content -diff --git a/cmake/external/onnx/third_party/benchmark/.ycm_extra_conf.py b/cmake/external/onnx/third_party/benchmark/.ycm_extra_conf.py -index 5649ddc..4ccbcde 100644 ---- a/cmake/external/onnx/third_party/benchmark/.ycm_extra_conf.py -+++ b/cmake/external/onnx/third_party/benchmark/.ycm_extra_conf.py -@@ -6,7 +6,6 @@ import ycm_core - # CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR. - flags = [ - '-Wall', --'-Werror', - '-pedantic-errors', - '-std=c++0x', - '-fno-strict-aliasing', -diff --git a/cmake/external/onnx/third_party/benchmark/CMakeLists.txt b/cmake/external/onnx/third_party/benchmark/CMakeLists.txt -index b1c1d3d..2d1f2b1 100644 ---- a/cmake/external/onnx/third_party/benchmark/CMakeLists.txt -+++ b/cmake/external/onnx/third_party/benchmark/CMakeLists.txt -@@ -133,9 +133,9 @@ else() - - add_cxx_compiler_flag(-Wextra) - add_cxx_compiler_flag(-Wshadow) -- add_cxx_compiler_flag(-Werror RELEASE) -- add_cxx_compiler_flag(-Werror RELWITHDEBINFO) -- add_cxx_compiler_flag(-Werror MINSIZEREL) -+# add_cxx_compiler_flag(-Werror RELEASE) -+# add_cxx_compiler_flag(-Werror RELWITHDEBINFO) -+# add_cxx_compiler_flag(-Werror MINSIZEREL) - add_cxx_compiler_flag(-pedantic) - add_cxx_compiler_flag(-pedantic-errors) - add_cxx_compiler_flag(-Wshorten-64-to-32) -diff --git a/cmake/external/onnx/third_party/benchmark/cmake/AddCXXCompilerFlag.cmake b/cmake/external/onnx/third_party/benchmark/cmake/AddCXXCompilerFlag.cmake -index d0d2099..0ebedc9 100644 ---- a/cmake/external/onnx/third_party/benchmark/cmake/AddCXXCompilerFlag.cmake -+++ b/cmake/external/onnx/third_party/benchmark/cmake/AddCXXCompilerFlag.cmake -@@ -68,7 +68,7 @@ function(check_cxx_warning_flag FLAG) - set(OLD_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") - # Add -Werror to ensure the compiler generates an error if the warning flag - # doesn't exist. -- set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror ${FLAG}") -+ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${FLAG}") - check_cxx_compiler_flag("${FLAG}" ${MANGLED_FLAG}) - set(CMAKE_REQUIRED_FLAGS "${OLD_CMAKE_REQUIRED_FLAGS}") - endfunction() -Submodule third_party/pybind11 contains modified content -diff --git a/cmake/external/onnx/third_party/pybind11/tests/CMakeLists.txt b/cmake/external/onnx/third_party/pybind11/tests/CMakeLists.txt -index df77d43..63cebdb 100644 ---- a/cmake/external/onnx/third_party/pybind11/tests/CMakeLists.txt -+++ b/cmake/external/onnx/third_party/pybind11/tests/CMakeLists.txt -@@ -129,7 +129,7 @@ function(pybind11_enable_warnings target_name) - if(MSVC) - target_compile_options(${target_name} PRIVATE /WX) - else() -- target_compile_options(${target_name} PRIVATE -Werror) -+# target_compile_options(${target_name} PRIVATE -Werror) - endif() - endif() - endfunction() -Submodule cmake/external/onnx-tensorrt contains modified content -Submodule third_party/onnx contains modified content -diff --git a/cmake/external/onnx-tensorrt/third_party/onnx/CMakeLists.txt b/cmake/external/onnx-tensorrt/third_party/onnx/CMakeLists.txt -index e64dfcec..776429d0 100644 ---- a/cmake/external/onnx-tensorrt/third_party/onnx/CMakeLists.txt -+++ b/cmake/external/onnx-tensorrt/third_party/onnx/CMakeLists.txt -@@ -473,7 +473,7 @@ elseif(APPLE) - else() - target_compile_options(onnx PRIVATE -Wall -Wextra) - if(${ONNX_WERROR}) -- target_compile_options(onnx PRIVATE -Werror) -+# target_compile_options(onnx PRIVATE -Werror) - endif() - endif() - -Submodule third_party/benchmark contains modified content -diff --git a/cmake/external/onnx-tensorrt/third_party/onnx/third_party/benchmark/.ycm_extra_conf.py b/cmake/external/onnx-tensorrt/third_party/onnx/third_party/benchmark/.ycm_extra_conf.py -index 5649ddc..4ccbcde 100644 ---- a/cmake/external/onnx-tensorrt/third_party/onnx/third_party/benchmark/.ycm_extra_conf.py -+++ b/cmake/external/onnx-tensorrt/third_party/onnx/third_party/benchmark/.ycm_extra_conf.py -@@ -6,7 +6,6 @@ import ycm_core - # CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR. - flags = [ - '-Wall', --'-Werror', - '-pedantic-errors', - '-std=c++0x', - '-fno-strict-aliasing', -diff --git a/cmake/external/onnx-tensorrt/third_party/onnx/third_party/benchmark/CMakeLists.txt b/cmake/external/onnx-tensorrt/third_party/onnx/third_party/benchmark/CMakeLists.txt -index b1c1d3d..2d1f2b1 100644 ---- a/cmake/external/onnx-tensorrt/third_party/onnx/third_party/benchmark/CMakeLists.txt -+++ b/cmake/external/onnx-tensorrt/third_party/onnx/third_party/benchmark/CMakeLists.txt -@@ -133,9 +133,9 @@ else() - - add_cxx_compiler_flag(-Wextra) - add_cxx_compiler_flag(-Wshadow) -- add_cxx_compiler_flag(-Werror RELEASE) -- add_cxx_compiler_flag(-Werror RELWITHDEBINFO) -- add_cxx_compiler_flag(-Werror MINSIZEREL) -+# add_cxx_compiler_flag(-Werror RELEASE) -+# add_cxx_compiler_flag(-Werror RELWITHDEBINFO) -+# add_cxx_compiler_flag(-Werror MINSIZEREL) - add_cxx_compiler_flag(-pedantic) - add_cxx_compiler_flag(-pedantic-errors) - add_cxx_compiler_flag(-Wshorten-64-to-32) -diff --git a/cmake/external/onnx-tensorrt/third_party/onnx/third_party/benchmark/cmake/AddCXXCompilerFlag.cmake b/cmake/external/onnx-tensorrt/third_party/onnx/third_party/benchmark/cmake/AddCXXCompilerFlag.cmake -index d0d2099..0ebedc9 100644 ---- a/cmake/external/onnx-tensorrt/third_party/onnx/third_party/benchmark/cmake/AddCXXCompilerFlag.cmake -+++ b/cmake/external/onnx-tensorrt/third_party/onnx/third_party/benchmark/cmake/AddCXXCompilerFlag.cmake -@@ -68,7 +68,7 @@ function(check_cxx_warning_flag FLAG) - set(OLD_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") - # Add -Werror to ensure the compiler generates an error if the warning flag - # doesn't exist. -- set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror ${FLAG}") -+ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${FLAG}") - check_cxx_compiler_flag("${FLAG}" ${MANGLED_FLAG}) - set(CMAKE_REQUIRED_FLAGS "${OLD_CMAKE_REQUIRED_FLAGS}") - endfunction() -Submodule third_party/pybind11 contains modified content -diff --git a/cmake/external/onnx-tensorrt/third_party/onnx/third_party/pybind11/tests/CMakeLists.txt b/cmake/external/onnx-tensorrt/third_party/onnx/third_party/pybind11/tests/CMakeLists.txt -index df77d43..63cebdb 100644 ---- a/cmake/external/onnx-tensorrt/third_party/onnx/third_party/pybind11/tests/CMakeLists.txt -+++ b/cmake/external/onnx-tensorrt/third_party/onnx/third_party/pybind11/tests/CMakeLists.txt -@@ -129,7 +129,7 @@ function(pybind11_enable_warnings target_name) - if(MSVC) - target_compile_options(${target_name} PRIVATE /WX) - else() -- target_compile_options(${target_name} PRIVATE -Werror) -+# target_compile_options(${target_name} PRIVATE -Werror) - endif() - endif() - endfunction() -Submodule cmake/external/protobuf contains modified content -diff --git a/cmake/external/protobuf/m4/ax_pthread.m4 b/cmake/external/protobuf/m4/ax_pthread.m4 -index d218d1af..d479c164 100644 ---- a/cmake/external/protobuf/m4/ax_pthread.m4 -+++ b/cmake/external/protobuf/m4/ax_pthread.m4 -@@ -299,7 +299,7 @@ if test "x$ax_pthread_clang" = "xyes"; then - ax_pthread_save_CFLAGS="$CFLAGS" - for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do - AS_IF([test "x$ax_pthread_try" = "xunknown"], [break]) -- CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" -+ CFLAGS="-Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" - ac_link="$ax_pthread_save_ac_link" - AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], - [ac_link="$ax_pthread_2step_ac_link" -diff --git a/cmake/external/protobuf/python/setup.py b/cmake/external/protobuf/python/setup.py -index a9df075e..e8d22dd4 100755 ---- a/cmake/external/protobuf/python/setup.py -+++ b/cmake/external/protobuf/python/setup.py -@@ -208,7 +208,7 @@ if __name__ == '__main__': - extra_compile_args.append('-std=c++11') - - if warnings_as_errors in sys.argv: -- extra_compile_args.append('-Werror') -+# extra_compile_args.append('-Werror') - sys.argv.remove(warnings_as_errors) - - # C++ implementation extension -diff --git a/cmake/external/protobuf/src/Makefile.am b/cmake/external/protobuf/src/Makefile.am -index 4bb77452..c95d46b7 100644 ---- a/cmake/external/protobuf/src/Makefile.am -+++ b/cmake/external/protobuf/src/Makefile.am -@@ -876,7 +876,7 @@ no_warning_test.cc: - - no_warning_test_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la - no_warning_test_CXXFLAGS = $(PTHREAD_CFLAGS) $(PTHREAD_DEF) $(ZLIB_DEF) \ -- -Wall -Wextra -Werror -Wno-unused-parameter -+ -Wall -Wextra -Wno-unused-parameter - nodist_no_warning_test_SOURCES = no_warning_test.cc $(protoc_outputs) - - TESTS = protobuf-test protobuf-lazy-descriptor-test protobuf-lite-test \ -Submodule third_party/benchmark contains modified content -diff --git a/cmake/external/protobuf/third_party/benchmark/.ycm_extra_conf.py b/cmake/external/protobuf/third_party/benchmark/.ycm_extra_conf.py -index 8619435..07141d3 100644 ---- a/cmake/external/protobuf/third_party/benchmark/.ycm_extra_conf.py -+++ b/cmake/external/protobuf/third_party/benchmark/.ycm_extra_conf.py -@@ -6,7 +6,6 @@ import ycm_core - # CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR. - flags = [ - '-Wall', --'-Werror', - '-pendantic-errors', - '-std=c++0x', - '-fno-strict-aliasing', -diff --git a/cmake/external/protobuf/third_party/benchmark/CMakeLists.txt b/cmake/external/protobuf/third_party/benchmark/CMakeLists.txt -index f7f1566..8e11602 100644 ---- a/cmake/external/protobuf/third_party/benchmark/CMakeLists.txt -+++ b/cmake/external/protobuf/third_party/benchmark/CMakeLists.txt -@@ -84,9 +84,9 @@ else() - - add_cxx_compiler_flag(-Wextra) - add_cxx_compiler_flag(-Wshadow) -- add_cxx_compiler_flag(-Werror RELEASE) -- add_cxx_compiler_flag(-Werror RELWITHDEBINFO) -- add_cxx_compiler_flag(-Werror MINSIZEREL) -+# add_cxx_compiler_flag(-Werror RELEASE) -+# add_cxx_compiler_flag(-Werror RELWITHDEBINFO) -+# add_cxx_compiler_flag(-Werror MINSIZEREL) - add_cxx_compiler_flag(-pedantic) - add_cxx_compiler_flag(-pedantic-errors) - add_cxx_compiler_flag(-Wshorten-64-to-32) -Submodule cmake/external/tvm contains modified content -diff --git a/cmake/external/tvm/Jenkinsfile b/cmake/external/tvm/Jenkinsfile -index f63e7d0f..33048562 100644 ---- a/cmake/external/tvm/Jenkinsfile -+++ b/cmake/external/tvm/Jenkinsfile -@@ -100,7 +100,6 @@ stage('Build') { - echo set\\(USE_GRAPH_RUNTIME_DEBUG ON\\) >> config.cmake - echo set\\(USE_BLAS openblas\\) >> config.cmake - echo set\\(CMAKE_CXX_COMPILER g++\\) >> config.cmake -- echo set\\(CMAKE_CXX_FLAGS -Werror\\) >> config.cmake - """ - make('tvmai/ci-gpu', 'build', '-j2') - pack_lib('gpu', tvm_multilib) -@@ -114,7 +113,6 @@ stage('Build') { - echo set\\(USE_VULKAN ON\\) >> config.cmake - echo set\\(USE_GRAPH_RUNTIME_DEBUG ON\\) >> config.cmake - echo set\\(CMAKE_CXX_COMPILER clang-6.0\\) >> config.cmake -- echo set\\(CMAKE_CXX_FLAGS -Werror\\) >> config.cmake - """ - make('tvmai/ci-gpu', 'build2', '-j2') - } -@@ -132,7 +130,6 @@ stage('Build') { - echo set\\(USE_GRAPH_RUNTIME_DEBUG ON\\) >> config.cmake - echo set\\(USE_LLVM llvm-config-4.0\\) >> config.cmake - echo set\\(CMAKE_CXX_COMPILER g++\\) >> config.cmake -- echo set\\(CMAKE_CXX_FLAGS -Werror\\) >> config.cmake - """ - make('tvmai/ci-cpu', 'build', '-j2') - pack_lib('cpu', tvm_lib) -@@ -157,7 +154,6 @@ stage('Build') { - echo set\\(USE_GRAPH_RUNTIME_DEBUG ON\\) >> config.cmake - echo set\\(USE_LLVM llvm-config-5.0\\) >> config.cmake - echo set\\(CMAKE_CXX_COMPILER g++\\) >> config.cmake -- echo set\\(CMAKE_CXX_FLAGS -Werror\\) >> config.cmake - """ - make('tvmai/ci-i386', 'build', '-j2') - pack_lib('i386', tvm_multilib) -diff --git a/tools/ci_build/build.py b/tools/ci_build/build.py -index 7449970d8..316668eee 100755 ---- a/tools/ci_build/build.py -+++ b/tools/ci_build/build.py -@@ -739,7 +739,7 @@ def main(): - if (args.build): - build_targets(cmake_path, build_dir, configs, args.parallel) - -- if args.test : -+ if False and args.test : - run_onnxruntime_tests(args, source_dir, ctest_path, build_dir, configs, - args.enable_pybind if not args.skip_onnx_tests else False, - args.use_tvm, args.use_tensorrt, args.use_ngraph) diff --git a/opt/build/onnxruntime/werror.patch b/opt/build/onnxruntime/werror.patch deleted file mode 100755 index ce22c419f..000000000 --- a/opt/build/onnxruntime/werror.patch +++ /dev/null @@ -1,759 +0,0 @@ -diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt -index f6252b9..613b47d 100644 ---- a/cmake/CMakeLists.txt -+++ b/cmake/CMakeLists.txt -@@ -427,8 +427,8 @@ else() - string(APPEND CMAKE_C_FLAGS " -Wall -Wextra -ffunction-sections -fdata-sections") - - if(onnxruntime_DEV_MODE) -- string(APPEND CMAKE_CXX_FLAGS " -Werror") -- string(APPEND CMAKE_C_FLAGS " -Werror") -+# string(APPEND CMAKE_CXX_FLAGS " -Werror") -+# string(APPEND CMAKE_C_FLAGS " -Werror") - endif() - check_cxx_compiler_flag(-Wunused-but-set-variable HAS_UNUSED_BUT_SET_VARIABLE) - check_cxx_compiler_flag(-Wunused-parameter HAS_UNUSED_PARAMETER) -Submodule cmake/external/eigen contains modified content -diff --git a/cmake/external/eigen/CMakeLists.txt b/cmake/external/eigen/CMakeLists.txt -index 76e083314..a515736cd 100644 ---- a/cmake/external/eigen/CMakeLists.txt -+++ b/cmake/external/eigen/CMakeLists.txt -@@ -151,10 +151,10 @@ if(NOT MSVC) - - # clang outputs some warnings for unknown flags that are not caught by check_cxx_compiler_flag - # adding -Werror turns such warnings into errors -- check_cxx_compiler_flag("-Werror" COMPILER_SUPPORT_WERROR) -- if(COMPILER_SUPPORT_WERROR) -- set(CMAKE_REQUIRED_FLAGS "-Werror") -- endif() -+# check_cxx_compiler_flag("-Werror" COMPILER_SUPPORT_WERROR) -+# if(COMPILER_SUPPORT_WERROR) -+# set(CMAKE_REQUIRED_FLAGS "-Werror") -+# endif() - ei_add_cxx_compiler_flag("-pedantic") - ei_add_cxx_compiler_flag("-Wall") - ei_add_cxx_compiler_flag("-Wextra") -Submodule cmake/external/googletest contains modified content -diff --git a/cmake/external/googletest/googletest/cmake/internal_utils.cmake b/cmake/external/googletest/googletest/cmake/internal_utils.cmake -index 6448918f..38e1a864 100644 ---- a/cmake/external/googletest/googletest/cmake/internal_utils.cmake -+++ b/cmake/external/googletest/googletest/cmake/internal_utils.cmake -@@ -94,7 +94,7 @@ macro(config_compiler_and_linker) - set(cxx_no_exception_flags "-EHs-c- -D_HAS_EXCEPTIONS=0") - set(cxx_no_rtti_flags "-GR-") - elseif (CMAKE_COMPILER_IS_GNUCXX) -- set(cxx_base_flags "-Wall -Wshadow -Werror") -+ set(cxx_base_flags "-Wall -Wshadow") - if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0.0) - set(cxx_base_flags "${cxx_base_flags} -Wno-error=dangling-else") - endif() -diff --git a/cmake/external/googletest/googletest/xcode/Config/General.xcconfig b/cmake/external/googletest/googletest/xcode/Config/General.xcconfig -index f23e3222..ac07337f 100644 ---- a/cmake/external/googletest/googletest/xcode/Config/General.xcconfig -+++ b/cmake/external/googletest/googletest/xcode/Config/General.xcconfig -@@ -17,7 +17,7 @@ ZERO_LINK = NO - PREBINDING = NO - - // Strictest warning policy --WARNING_CFLAGS = -Wall -Werror -Wendif-labels -Wnewline-eof -Wno-sign-compare -Wshadow -+WARNING_CFLAGS = -Wall -Wendif-labels -Wnewline-eof -Wno-sign-compare -Wshadow - - // Work around Xcode bugs by using external strip. See: - // http://lists.apple.com/archives/Xcode-users/2006/Feb/msg00050.html -Submodule cmake/external/gsl contains modified content -diff --git a/cmake/external/gsl/tests/CMakeLists.txt b/cmake/external/gsl/tests/CMakeLists.txt -index 0e08d77..a4d103d 100644 ---- a/cmake/external/gsl/tests/CMakeLists.txt -+++ b/cmake/external/gsl/tests/CMakeLists.txt -@@ -41,7 +41,7 @@ target_compile_options(gsl_tests_config INTERFACE - -Wcast-align - -Wconversion - -Wctor-dtor-privacy -- -Werror -+# -Werror - -Wextra - -Wno-missing-braces - -Wnon-virtual-dtor -@@ -129,7 +129,7 @@ target_compile_options(gsl_tests_config_noexcept INTERFACE - -Wcast-align - -Wconversion - -Wctor-dtor-privacy -- -Werror -+# -Werror - -Wextra - -Wno-missing-braces - -Wnon-virtual-dtor -Submodule cmake/external/nsync contains modified content -diff --git a/cmake/external/nsync/builds/aarch64.linux.c++11/Makefile b/cmake/external/nsync/builds/aarch64.linux.c++11/Makefile -index d7b138b..d76d43f 100644 ---- a/cmake/external/nsync/builds/aarch64.linux.c++11/Makefile -+++ b/cmake/external/nsync/builds/aarch64.linux.c++11/Makefile -@@ -2,7 +2,7 @@ - # use futex directly. - CC=g++ - PLATFORM_CPPFLAGS=-DNSYNC_USE_CPP11_TIMEPOINT -DNSYNC_ATOMIC_CPP11 -I../../platform/c++11.futex -I../../platform/c++11 -I../../platform/gcc -I../../platform/posix -pthread --PLATFORM_CFLAGS=-std=c++11 -Werror -Wall -Wextra -pedantic -+PLATFORM_CFLAGS=-std=c++11 -Wall -Wextra -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M -std=c++11 - PLATFORM_C=../../platform/linux/src/nsync_semaphore_futex.c ../../platform/c++11/src/per_thread_waiter.cc ../../platform/c++11/src/yield.cc ../../platform/c++11/src/time_rep_timespec.cc ../../platform/c++11/src/nsync_panic.cc -diff --git a/cmake/external/nsync/builds/aarch64.linux.clang/Makefile b/cmake/external/nsync/builds/aarch64.linux.clang/Makefile -index 291b3db..961aea1 100644 ---- a/cmake/external/nsync/builds/aarch64.linux.clang/Makefile -+++ b/cmake/external/nsync/builds/aarch64.linux.clang/Makefile -@@ -1,6 +1,6 @@ - CC=clang - PLATFORM_CPPFLAGS=-D_POSIX_C_SOURCE=200809L -I../../platform/clang -I../../platform/linux -I../../platform/aarch64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -Wno-unneeded-internal-declaration -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic -Wno-unneeded-internal-declaration - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/linux/src/nsync_semaphore_futex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/aarch64.linux.g++/Makefile b/cmake/external/nsync/builds/aarch64.linux.g++/Makefile -index d4f0528..d1e2f24 100644 ---- a/cmake/external/nsync/builds/aarch64.linux.g++/Makefile -+++ b/cmake/external/nsync/builds/aarch64.linux.g++/Makefile -@@ -1,6 +1,6 @@ - CC=g++ - PLATFORM_CPPFLAGS=-DNSYNC_ATOMIC_CPP11 -I../../platform/linux -I../../platform/c++11 -D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/aarch64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-x c++ -std=c++11 -Werror -Wall -Wextra -pedantic -+PLATFORM_CFLAGS=-x c++ -std=c++11 -Wall -Wextra -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M -x c++ -std=c++11 - PLATFORM_C=../../platform/linux/src/nsync_semaphore_futex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/aarch64.linux.gcc.atm-asm/Makefile b/cmake/external/nsync/builds/aarch64.linux.gcc.atm-asm/Makefile -index d5e168e..3218ce0 100644 ---- a/cmake/external/nsync/builds/aarch64.linux.gcc.atm-asm/Makefile -+++ b/cmake/external/nsync/builds/aarch64.linux.gcc.atm-asm/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-I../../platform/atomic_ind -D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/linux -I../../platform/aarch64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/linux/src/nsync_semaphore_futex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/aarch64.linux.gcc.atm-c++11/Makefile b/cmake/external/nsync/builds/aarch64.linux.gcc.atm-c++11/Makefile -index 6251fed..238dd54 100644 ---- a/cmake/external/nsync/builds/aarch64.linux.gcc.atm-c++11/Makefile -+++ b/cmake/external/nsync/builds/aarch64.linux.gcc.atm-c++11/Makefile -@@ -1,7 +1,7 @@ - PLATFORM_CPPFLAGS=-I../../platform/atomic_ind -D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/linux -I../../platform/aarch64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread --PLATFORM_CXXFLAGS=-Werror -Wall -Wextra -std=c++11 -pedantic -+PLATFORM_CXXFLAGS=-Wall -Wextra -std=c++11 -pedantic - PLATFORM_CXX=../../platform/c_from_c++11/src/nsync_atm_c++.cc - MKDEP_DEPEND=mkdep - MKDEP=./mkdep ${CC} -E -c++=-std=c++11 -diff --git a/cmake/external/nsync/builds/aarch64.linux.gcc.atm-c11/Makefile b/cmake/external/nsync/builds/aarch64.linux.gcc.atm-c11/Makefile -index 10d1104..21a2f43 100644 ---- a/cmake/external/nsync/builds/aarch64.linux.gcc.atm-c11/Makefile -+++ b/cmake/external/nsync/builds/aarch64.linux.gcc.atm-c11/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-DNSYNC_ATOMIC_C11 -I../../platform/c11 -D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/linux -I../../platform/aarch64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/linux/src/nsync_semaphore_futex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/aarch64.linux.gcc.sem-mutex/Makefile b/cmake/external/nsync/builds/aarch64.linux.gcc.sem-mutex/Makefile -index 5352904..a428b34 100644 ---- a/cmake/external/nsync/builds/aarch64.linux.gcc.sem-mutex/Makefile -+++ b/cmake/external/nsync/builds/aarch64.linux.gcc.sem-mutex/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/linux -I../../platform/aarch64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/posix/src/nsync_semaphore_mutex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/aarch64.linux.gcc.sem-sem_t/Makefile b/cmake/external/nsync/builds/aarch64.linux.gcc.sem-sem_t/Makefile -index 79a4f6d..c642bde 100644 ---- a/cmake/external/nsync/builds/aarch64.linux.gcc.sem-sem_t/Makefile -+++ b/cmake/external/nsync/builds/aarch64.linux.gcc.sem-sem_t/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/linux -I../../platform/aarch64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/posix/src/nsync_semaphore_sem_t.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/aarch64.linux.gcc/Makefile b/cmake/external/nsync/builds/aarch64.linux.gcc/Makefile -index 7dbeb25..487fc55 100644 ---- a/cmake/external/nsync/builds/aarch64.linux.gcc/Makefile -+++ b/cmake/external/nsync/builds/aarch64.linux.gcc/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/linux -I../../platform/aarch64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/linux/src/nsync_semaphore_futex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/arm.linux.gcc.atm-asm.lrt/Makefile b/cmake/external/nsync/builds/arm.linux.gcc.atm-asm.lrt/Makefile -index 3cd81a1..bb88607 100644 ---- a/cmake/external/nsync/builds/arm.linux.gcc.atm-asm.lrt/Makefile -+++ b/cmake/external/nsync/builds/arm.linux.gcc.atm-asm.lrt/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-I../../platform/atomic_ind -D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/linux -I../../platform/arm -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread - PLATFORM_LIBS=-lrt - MKDEP=${CC} -M -diff --git a/cmake/external/nsync/builds/arm.linux.gcc.lrt/Makefile b/cmake/external/nsync/builds/arm.linux.gcc.lrt/Makefile -index 009cd01..f058b7f 100644 ---- a/cmake/external/nsync/builds/arm.linux.gcc.lrt/Makefile -+++ b/cmake/external/nsync/builds/arm.linux.gcc.lrt/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/linux -I../../platform/arm -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread - PLATFORM_LIBS=-lrt - MKDEP=${CC} -M -diff --git a/cmake/external/nsync/builds/x86_64.linux.c++11/Makefile b/cmake/external/nsync/builds/x86_64.linux.c++11/Makefile -index d7b138b..d76d43f 100644 ---- a/cmake/external/nsync/builds/x86_64.linux.c++11/Makefile -+++ b/cmake/external/nsync/builds/x86_64.linux.c++11/Makefile -@@ -2,7 +2,7 @@ - # use futex directly. - CC=g++ - PLATFORM_CPPFLAGS=-DNSYNC_USE_CPP11_TIMEPOINT -DNSYNC_ATOMIC_CPP11 -I../../platform/c++11.futex -I../../platform/c++11 -I../../platform/gcc -I../../platform/posix -pthread --PLATFORM_CFLAGS=-std=c++11 -Werror -Wall -Wextra -pedantic -+PLATFORM_CFLAGS=-std=c++11 -Wall -Wextra -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M -std=c++11 - PLATFORM_C=../../platform/linux/src/nsync_semaphore_futex.c ../../platform/c++11/src/per_thread_waiter.cc ../../platform/c++11/src/yield.cc ../../platform/c++11/src/time_rep_timespec.cc ../../platform/c++11/src/nsync_panic.cc -diff --git a/cmake/external/nsync/builds/x86_64.linux.clang/Makefile b/cmake/external/nsync/builds/x86_64.linux.clang/Makefile -index dc16f1f..dfa2bfb 100644 ---- a/cmake/external/nsync/builds/x86_64.linux.clang/Makefile -+++ b/cmake/external/nsync/builds/x86_64.linux.clang/Makefile -@@ -1,6 +1,6 @@ - CC=clang - PLATFORM_CPPFLAGS=-D_POSIX_C_SOURCE=200809L -I../../platform/clang -I../../platform/linux -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -Wno-unneeded-internal-declaration -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic -Wno-unneeded-internal-declaration - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/linux/src/nsync_semaphore_futex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/x86_64.linux.g++/Makefile b/cmake/external/nsync/builds/x86_64.linux.g++/Makefile -index 990e1e4..a55a5db 100644 ---- a/cmake/external/nsync/builds/x86_64.linux.g++/Makefile -+++ b/cmake/external/nsync/builds/x86_64.linux.g++/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-DNSYNC_ATOMIC_CPP11 -I../../platform/linux -I../../platform/c++11 -D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-x c++ -std=c++11 -Werror -Wall -Wextra -pedantic -+PLATFORM_CFLAGS=-x c++ -std=c++11 -Wall -Wextra -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M -x c++ -std=c++11 - PLATFORM_C=../../platform/linux/src/nsync_semaphore_futex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/x86_64.linux.gcc.atm-asm/Makefile b/cmake/external/nsync/builds/x86_64.linux.gcc.atm-asm/Makefile -index 870772e..26df437 100644 ---- a/cmake/external/nsync/builds/x86_64.linux.gcc.atm-asm/Makefile -+++ b/cmake/external/nsync/builds/x86_64.linux.gcc.atm-asm/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-I../../platform/atomic_ind -D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/linux -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/linux/src/nsync_semaphore_futex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/x86_64.linux.gcc.atm-c++11/Makefile b/cmake/external/nsync/builds/x86_64.linux.gcc.atm-c++11/Makefile -index 6dad2b7..e98d035 100644 ---- a/cmake/external/nsync/builds/x86_64.linux.gcc.atm-c++11/Makefile -+++ b/cmake/external/nsync/builds/x86_64.linux.gcc.atm-c++11/Makefile -@@ -1,7 +1,7 @@ - PLATFORM_CPPFLAGS=-I../../platform/atomic_ind -D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/linux -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread --PLATFORM_CXXFLAGS=-Werror -Wall -Wextra -std=c++11 -pedantic -+PLATFORM_CXXFLAGS=-Wall -Wextra -std=c++11 -pedantic - PLATFORM_CXX=../../platform/c_from_c++11/src/nsync_atm_c++.cc - MKDEP_DEPEND=mkdep - MKDEP=./mkdep ${CC} -E -c++=-std=c++11 -diff --git a/cmake/external/nsync/builds/x86_64.linux.gcc.atm-c11/Makefile b/cmake/external/nsync/builds/x86_64.linux.gcc.atm-c11/Makefile -index a7c98a1..395e8c9 100644 ---- a/cmake/external/nsync/builds/x86_64.linux.gcc.atm-c11/Makefile -+++ b/cmake/external/nsync/builds/x86_64.linux.gcc.atm-c11/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-DNSYNC_ATOMIC_C11 -I../../platform/c11 -D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/linux -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -Wno-unneeded-internal-declaration -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic -Wno-unneeded-internal-declaration - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/linux/src/nsync_semaphore_futex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/x86_64.linux.gcc.sem-mutex/Makefile b/cmake/external/nsync/builds/x86_64.linux.gcc.sem-mutex/Makefile -index 035c19f..3ba36e3 100644 ---- a/cmake/external/nsync/builds/x86_64.linux.gcc.sem-mutex/Makefile -+++ b/cmake/external/nsync/builds/x86_64.linux.gcc.sem-mutex/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/linux -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/posix/src/nsync_semaphore_mutex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/x86_64.linux.gcc.sem-sem_t/Makefile b/cmake/external/nsync/builds/x86_64.linux.gcc.sem-sem_t/Makefile -index 040611c..394abf7 100644 ---- a/cmake/external/nsync/builds/x86_64.linux.gcc.sem-sem_t/Makefile -+++ b/cmake/external/nsync/builds/x86_64.linux.gcc.sem-sem_t/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/linux -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/posix/src/nsync_semaphore_sem_t.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/x86_64.linux.gcc/Makefile b/cmake/external/nsync/builds/x86_64.linux.gcc/Makefile -index 4bfa290..0174802 100644 ---- a/cmake/external/nsync/builds/x86_64.linux.gcc/Makefile -+++ b/cmake/external/nsync/builds/x86_64.linux.gcc/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/linux -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/linux/src/nsync_semaphore_futex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/x86_64.linux.old_gcc/Makefile b/cmake/external/nsync/builds/x86_64.linux.old_gcc/Makefile -index 347c2ce..6e70f0f 100644 ---- a/cmake/external/nsync/builds/x86_64.linux.old_gcc/Makefile -+++ b/cmake/external/nsync/builds/x86_64.linux.old_gcc/Makefile -@@ -1,6 +1,6 @@ - # Force the use of old gcc atomics. - PLATFORM_CPPFLAGS=-D_POSIX_C_SOURCE=200809L -I../../platform/gcc_old -I../../platform/gcc -I../../platform/linux -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/linux/src/nsync_semaphore_futex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/x86_64.linux.tcc/Makefile b/cmake/external/nsync/builds/x86_64.linux.tcc/Makefile -index 732265f..f986e91 100644 ---- a/cmake/external/nsync/builds/x86_64.linux.tcc/Makefile -+++ b/cmake/external/nsync/builds/x86_64.linux.tcc/Makefile -@@ -1,6 +1,6 @@ - CC=tcc - PLATFORM_CPPFLAGS=-I../../platform/atomic_ind -D_POSIX_C_SOURCE=200809L -I../../platform/tcc -I../../platform/linux -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -+PLATFORM_CFLAGS=-Wall - PLATFORM_LDFLAGS=-pthread - MKDEP_DEPEND=mkdep - MKDEP=./mkdep ${CC} -E -diff --git a/cmake/external/nsync/builds/x86_64.macos.c++11/Makefile b/cmake/external/nsync/builds/x86_64.macos.c++11/Makefile -index 4142416..2b552ae 100644 ---- a/cmake/external/nsync/builds/x86_64.macos.c++11/Makefile -+++ b/cmake/external/nsync/builds/x86_64.macos.c++11/Makefile -@@ -1,7 +1,7 @@ - CC=clang++ - # Some versions of MacOS (such as Sierra) require _DARWIN_C_SOURCE to include , , and (!) - PLATFORM_CPPFLAGS=-DNSYNC_USE_CPP11_TIMEPOINT -DNSYNC_ATOMIC_CPP11 -D_DARWIN_C_SOURCE -I../../platform/c++11 -I../../platform/gcc -I../../platform/macos -I../../platform/posix -pthread --PLATFORM_CFLAGS=-x c++ -std=c++11 -Werror -Wall -Wextra -pedantic -+PLATFORM_CFLAGS=-x c++ -std=c++11 -Wall -Wextra -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -x c++ -M -std=c++11 - # Currently, MacOS's C++11 implementation is incomplete, and does not support -diff --git a/cmake/external/nsync/builds/x86_64.macos.clang.atm-c++11/Makefile b/cmake/external/nsync/builds/x86_64.macos.clang.atm-c++11/Makefile -index bf15b64..1122bb1 100644 ---- a/cmake/external/nsync/builds/x86_64.macos.clang.atm-c++11/Makefile -+++ b/cmake/external/nsync/builds/x86_64.macos.clang.atm-c++11/Makefile -@@ -1,7 +1,7 @@ - PLATFORM_CPPFLAGS=-I../../platform/atomic_ind -D_POSIX_C_SOURCE=200809L -I../../platform/clang -I../../platform/macos -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -Wno-unneeded-internal-declaration -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic -Wno-unneeded-internal-declaration - PLATFORM_LDFLAGS=-pthread --PLATFORM_CXXFLAGS=-Werror -Wall -Wextra -std=c++11 -pedantic -+PLATFORM_CXXFLAGS=-Wall -Wextra -std=c++11 -pedantic - PLATFORM_CXX=../../platform/c_from_c++11/src/nsync_atm_c++.cc - MKDEP_DEPEND=mkdep - MKDEP=./mkdep ${CC} -E -c++=-std=c++11 -diff --git a/cmake/external/nsync/builds/x86_64.macos.clang.atm-c11/Makefile b/cmake/external/nsync/builds/x86_64.macos.clang.atm-c11/Makefile -index 653f99a..eb925bb 100644 ---- a/cmake/external/nsync/builds/x86_64.macos.clang.atm-c11/Makefile -+++ b/cmake/external/nsync/builds/x86_64.macos.clang.atm-c11/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-D_POSIX_C_SOURCE=200809L -DNSYNC_ATOMIC_C11 -I../../platform/c11 -I../../platform/macos -I../../platform/clang -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -Wno-unneeded-internal-declaration -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic -Wno-unneeded-internal-declaration - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/posix/src/clock_gettime.c ../../platform/posix/src/nsync_semaphore_mutex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/x86_64.macos.clang.atm-os/Makefile b/cmake/external/nsync/builds/x86_64.macos.clang.atm-os/Makefile -index 04943e3..cf8fc7f 100644 ---- a/cmake/external/nsync/builds/x86_64.macos.clang.atm-os/Makefile -+++ b/cmake/external/nsync/builds/x86_64.macos.clang.atm-os/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-D_POSIX_C_SOURCE=200809L -I../../platform/macos -I../../platform/clang -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -Wno-unneeded-internal-declaration -Wno-deprecated-declarations -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic -Wno-unneeded-internal-declaration -Wno-deprecated-declarations - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/posix/src/clock_gettime.c ../../platform/posix/src/nsync_semaphore_mutex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/x86_64.macos.clang/Makefile b/cmake/external/nsync/builds/x86_64.macos.clang/Makefile -index 2b36b8d..c02e528 100644 ---- a/cmake/external/nsync/builds/x86_64.macos.clang/Makefile -+++ b/cmake/external/nsync/builds/x86_64.macos.clang/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-D_POSIX_C_SOURCE=200809L -I../../platform/clang -I../../platform/macos -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -Wno-unneeded-internal-declaration -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic -Wno-unneeded-internal-declaration - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/posix/src/clock_gettime.c ../../platform/posix/src/nsync_semaphore_mutex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/x86_64.netbsd.gcc.atm-asm/Makefile b/cmake/external/nsync/builds/x86_64.netbsd.gcc.atm-asm/Makefile -index adce5dc..e90f92e 100644 ---- a/cmake/external/nsync/builds/x86_64.netbsd.gcc.atm-asm/Makefile -+++ b/cmake/external/nsync/builds/x86_64.netbsd.gcc.atm-asm/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-I../../platform/atomic_ind -D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/netbsd -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/posix/src/nsync_semaphore_mutex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/x86_64.netbsd.gcc/Makefile b/cmake/external/nsync/builds/x86_64.netbsd.gcc/Makefile -index d8d7247..aa46d8e 100644 ---- a/cmake/external/nsync/builds/x86_64.netbsd.gcc/Makefile -+++ b/cmake/external/nsync/builds/x86_64.netbsd.gcc/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-D_POSIX_C_SOURCE=200809L -I../../platform/gcc -I../../platform/netbsd -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/posix/src/nsync_semaphore_mutex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/builds/x86_64.openbsd.gcc/Makefile b/cmake/external/nsync/builds/x86_64.openbsd.gcc/Makefile -index 8d9b035..ded5309 100644 ---- a/cmake/external/nsync/builds/x86_64.openbsd.gcc/Makefile -+++ b/cmake/external/nsync/builds/x86_64.openbsd.gcc/Makefile -@@ -1,5 +1,5 @@ - PLATFORM_CPPFLAGS=-D_POSIX_C_SOURCE=200809L -I../../platform/gcc_no_tls -I../../platform/gcc -I../../platform/openbsd -I../../platform/x86_64 -I../../platform/posix -pthread --PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -+PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic - PLATFORM_LDFLAGS=-pthread - MKDEP=${CC} -M - PLATFORM_C=../../platform/posix/src/nsync_semaphore_mutex.c ../../platform/posix/src/per_thread_waiter.c ../../platform/posix/src/yield.c ../../platform/posix/src/time_rep.c ../../platform/posix/src/nsync_panic.c -diff --git a/cmake/external/nsync/tools/mkmakefile.sh b/cmake/external/nsync/tools/mkmakefile.sh -index 365b34b..962962a 100644 ---- a/cmake/external/nsync/tools/mkmakefile.sh -+++ b/cmake/external/nsync/tools/mkmakefile.sh -@@ -281,11 +281,11 @@ makefile=` - esac - case "$cc_type.$cplusplus" in - gcc.) echo "PLATFORM_CPPFLAGS=$atomic_ind$cppflags" -- echo "PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic" -+ echo "PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic" - case "$ldflags" in ?*) echo "PLATFORM_LDFLAGS=$ldflags";; esac - case "$libs" in ?*) echo "PLATFORM_LIBS=$libs";; esac - case "$atomics" in -- c++11) echo "PLATFORM_CXXFLAGS=-Werror -Wall -Wextra -std=c++11 -pedantic" -+ c++11) echo "PLATFORM_CXXFLAGS=-Wall -Wextra -std=c++11 -pedantic" - echo "PLATFORM_CXX=../../platform/c_from_c++11/src/nsync_atm_c++.cc" - echo "MKDEP_DEPEND=mkdep" - echo 'MKDEP=./mkdep ${CC} -E -c++=-std=c++11' -@@ -299,11 +299,11 @@ makefile=` - echo "TEST_PLATFORM_OBJS=$test_platform_o" - ;; - clang.) echo "PLATFORM_CPPFLAGS=$atomic_ind$cppflags" -- echo "PLATFORM_CFLAGS=-Werror -Wall -Wextra -ansi -pedantic -Wno-unneeded-internal-declaration" -+ echo "PLATFORM_CFLAGS=-Wall -Wextra -ansi -pedantic -Wno-unneeded-internal-declaration" - case "$ldflags" in ?*) echo "PLATFORM_LDFLAGS=$ldflags";; esac - case "$libs" in ?*) echo "PLATFORM_LIBS=$libs";; esac - case "$atomics" in -- c++11) echo "PLATFORM_CXXFLAGS=-Werror -Wall -Wextra -std=c++11 -pedantic" -+ c++11) echo "PLATFORM_CXXFLAGS=-Wall -Wextra -std=c++11 -pedantic" - echo "PLATFORM_CXX=../../platform/c_from_c++11/src/nsync_atm_c++.cc" - echo "MKDEP_DEPEND=mkdep" - echo 'MKDEP=./mkdep ${CC} -E -c++=-std=c++11' -@@ -317,7 +317,7 @@ makefile=` - echo "TEST_PLATFORM_OBJS=$test_platform_o" - ;; - gcc.c++) echo "PLATFORM_CPPFLAGS=-DNSYNC_ATOMIC_CPP11 -I../../platform/c++11 $cppflags" -- echo "PLATFORM_CFLAGS=-x c++ -std=c++11 -Werror -Wall -Wextra -pedantic" -+ echo "PLATFORM_CFLAGS=-x c++ -std=c++11 -Wall -Wextra -pedantic" - case "$ldflags" in ?*) echo "PLATFORM_LDFLAGS=$ldflags";; esac - case "$libs" in ?*) echo "PLATFORM_LIBS=$libs";; esac - echo 'MKDEP=${CC} -M -x c++ -std=c++11' -@@ -328,7 +328,7 @@ makefile=` - echo "TEST_PLATFORM_OBJS=$test_platform_o" - ;; - clang.c++) echo "PLATFORM_CPPFLAGS=-DNSYNC_ATOMIC_CPP11 -I../../platform/c++11 $cppflags" -- echo "PLATFORM_CFLAGS=-x c++ -std=c++11 -Werror -Wall -Wextra -pedantic -Wno-unneeded-internal-declaration" -+ echo "PLATFORM_CFLAGS=-x c++ -std=c++11 -Wall -Wextra -pedantic -Wno-unneeded-internal-declaration" - case "$ldflags" in ?*) echo "PLATFORM_LDFLAGS=$ldflags";; esac - case "$libs" in ?*) echo "PLATFORM_LIBS=$libs";; esac - echo 'MKDEP=${CC} -M -x c++ -std=c++11' -@@ -339,7 +339,7 @@ makefile=` - echo "TEST_PLATFORM_OBJS=$test_platform_o" - ;; - tcc.) echo "PLATFORM_CPPFLAGS=$atomic_ind$cppflags" -- echo "PLATFORM_CFLAGS=-Werror -Wall" -+ echo "PLATFORM_CFLAGS=-Wall" - case "$ldflags" in ?*) echo "PLATFORM_LDFLAGS=$ldflags";; esac - case "$libs" in ?*) echo "PLATFORM_LIBS=$libs";; esac - echo "MKDEP_DEPEND=mkdep" -Submodule cmake/external/onnx contains modified content -diff --git a/cmake/external/onnx/CMakeLists.txt b/cmake/external/onnx/CMakeLists.txt -index 195b0486..1c903bdf 100644 ---- a/cmake/external/onnx/CMakeLists.txt -+++ b/cmake/external/onnx/CMakeLists.txt -@@ -485,7 +485,7 @@ elseif(APPLE) - else() - target_compile_options(onnx PRIVATE -Wall -Wextra) - if(${ONNX_WERROR}) -- target_compile_options(onnx PRIVATE -Werror) -+# target_compile_options(onnx PRIVATE -Werror) - endif() - endif() - -Submodule third_party/benchmark contains modified content -diff --git a/cmake/external/onnx/third_party/benchmark/.ycm_extra_conf.py b/cmake/external/onnx/third_party/benchmark/.ycm_extra_conf.py -index 5649ddc..4ccbcde 100644 ---- a/cmake/external/onnx/third_party/benchmark/.ycm_extra_conf.py -+++ b/cmake/external/onnx/third_party/benchmark/.ycm_extra_conf.py -@@ -6,7 +6,6 @@ import ycm_core - # CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR. - flags = [ - '-Wall', --'-Werror', - '-pedantic-errors', - '-std=c++0x', - '-fno-strict-aliasing', -diff --git a/cmake/external/onnx/third_party/benchmark/CMakeLists.txt b/cmake/external/onnx/third_party/benchmark/CMakeLists.txt -index b1c1d3d..2d1f2b1 100644 ---- a/cmake/external/onnx/third_party/benchmark/CMakeLists.txt -+++ b/cmake/external/onnx/third_party/benchmark/CMakeLists.txt -@@ -133,9 +133,9 @@ else() - - add_cxx_compiler_flag(-Wextra) - add_cxx_compiler_flag(-Wshadow) -- add_cxx_compiler_flag(-Werror RELEASE) -- add_cxx_compiler_flag(-Werror RELWITHDEBINFO) -- add_cxx_compiler_flag(-Werror MINSIZEREL) -+# add_cxx_compiler_flag(-Werror RELEASE) -+# add_cxx_compiler_flag(-Werror RELWITHDEBINFO) -+# add_cxx_compiler_flag(-Werror MINSIZEREL) - add_cxx_compiler_flag(-pedantic) - add_cxx_compiler_flag(-pedantic-errors) - add_cxx_compiler_flag(-Wshorten-64-to-32) -diff --git a/cmake/external/onnx/third_party/benchmark/cmake/AddCXXCompilerFlag.cmake b/cmake/external/onnx/third_party/benchmark/cmake/AddCXXCompilerFlag.cmake -index d0d2099..0ebedc9 100644 ---- a/cmake/external/onnx/third_party/benchmark/cmake/AddCXXCompilerFlag.cmake -+++ b/cmake/external/onnx/third_party/benchmark/cmake/AddCXXCompilerFlag.cmake -@@ -68,7 +68,7 @@ function(check_cxx_warning_flag FLAG) - set(OLD_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") - # Add -Werror to ensure the compiler generates an error if the warning flag - # doesn't exist. -- set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror ${FLAG}") -+ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${FLAG}") - check_cxx_compiler_flag("${FLAG}" ${MANGLED_FLAG}) - set(CMAKE_REQUIRED_FLAGS "${OLD_CMAKE_REQUIRED_FLAGS}") - endfunction() -Submodule third_party/pybind11 contains modified content -diff --git a/cmake/external/onnx/third_party/pybind11/tests/CMakeLists.txt b/cmake/external/onnx/third_party/pybind11/tests/CMakeLists.txt -index df77d43..63cebdb 100644 ---- a/cmake/external/onnx/third_party/pybind11/tests/CMakeLists.txt -+++ b/cmake/external/onnx/third_party/pybind11/tests/CMakeLists.txt -@@ -129,7 +129,7 @@ function(pybind11_enable_warnings target_name) - if(MSVC) - target_compile_options(${target_name} PRIVATE /WX) - else() -- target_compile_options(${target_name} PRIVATE -Werror) -+# target_compile_options(${target_name} PRIVATE -Werror) - endif() - endif() - endfunction() -Submodule cmake/external/onnx-tensorrt contains modified content -Submodule third_party/onnx contains modified content -diff --git a/cmake/external/onnx-tensorrt/third_party/onnx/CMakeLists.txt b/cmake/external/onnx-tensorrt/third_party/onnx/CMakeLists.txt -index e64dfcec..776429d0 100644 ---- a/cmake/external/onnx-tensorrt/third_party/onnx/CMakeLists.txt -+++ b/cmake/external/onnx-tensorrt/third_party/onnx/CMakeLists.txt -@@ -473,7 +473,7 @@ elseif(APPLE) - else() - target_compile_options(onnx PRIVATE -Wall -Wextra) - if(${ONNX_WERROR}) -- target_compile_options(onnx PRIVATE -Werror) -+# target_compile_options(onnx PRIVATE -Werror) - endif() - endif() - -Submodule third_party/benchmark contains modified content -diff --git a/cmake/external/onnx-tensorrt/third_party/onnx/third_party/benchmark/.ycm_extra_conf.py b/cmake/external/onnx-tensorrt/third_party/onnx/third_party/benchmark/.ycm_extra_conf.py -index 5649ddc..4ccbcde 100644 ---- a/cmake/external/onnx-tensorrt/third_party/onnx/third_party/benchmark/.ycm_extra_conf.py -+++ b/cmake/external/onnx-tensorrt/third_party/onnx/third_party/benchmark/.ycm_extra_conf.py -@@ -6,7 +6,6 @@ import ycm_core - # CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR. - flags = [ - '-Wall', --'-Werror', - '-pedantic-errors', - '-std=c++0x', - '-fno-strict-aliasing', -diff --git a/cmake/external/onnx-tensorrt/third_party/onnx/third_party/benchmark/CMakeLists.txt b/cmake/external/onnx-tensorrt/third_party/onnx/third_party/benchmark/CMakeLists.txt -index b1c1d3d..2d1f2b1 100644 ---- a/cmake/external/onnx-tensorrt/third_party/onnx/third_party/benchmark/CMakeLists.txt -+++ b/cmake/external/onnx-tensorrt/third_party/onnx/third_party/benchmark/CMakeLists.txt -@@ -133,9 +133,9 @@ else() - - add_cxx_compiler_flag(-Wextra) - add_cxx_compiler_flag(-Wshadow) -- add_cxx_compiler_flag(-Werror RELEASE) -- add_cxx_compiler_flag(-Werror RELWITHDEBINFO) -- add_cxx_compiler_flag(-Werror MINSIZEREL) -+# add_cxx_compiler_flag(-Werror RELEASE) -+# add_cxx_compiler_flag(-Werror RELWITHDEBINFO) -+# add_cxx_compiler_flag(-Werror MINSIZEREL) - add_cxx_compiler_flag(-pedantic) - add_cxx_compiler_flag(-pedantic-errors) - add_cxx_compiler_flag(-Wshorten-64-to-32) -diff --git a/cmake/external/onnx-tensorrt/third_party/onnx/third_party/benchmark/cmake/AddCXXCompilerFlag.cmake b/cmake/external/onnx-tensorrt/third_party/onnx/third_party/benchmark/cmake/AddCXXCompilerFlag.cmake -index d0d2099..0ebedc9 100644 ---- a/cmake/external/onnx-tensorrt/third_party/onnx/third_party/benchmark/cmake/AddCXXCompilerFlag.cmake -+++ b/cmake/external/onnx-tensorrt/third_party/onnx/third_party/benchmark/cmake/AddCXXCompilerFlag.cmake -@@ -68,7 +68,7 @@ function(check_cxx_warning_flag FLAG) - set(OLD_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") - # Add -Werror to ensure the compiler generates an error if the warning flag - # doesn't exist. -- set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror ${FLAG}") -+ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${FLAG}") - check_cxx_compiler_flag("${FLAG}" ${MANGLED_FLAG}) - set(CMAKE_REQUIRED_FLAGS "${OLD_CMAKE_REQUIRED_FLAGS}") - endfunction() -Submodule third_party/pybind11 contains modified content -diff --git a/cmake/external/onnx-tensorrt/third_party/onnx/third_party/pybind11/tests/CMakeLists.txt b/cmake/external/onnx-tensorrt/third_party/onnx/third_party/pybind11/tests/CMakeLists.txt -index df77d43..63cebdb 100644 ---- a/cmake/external/onnx-tensorrt/third_party/onnx/third_party/pybind11/tests/CMakeLists.txt -+++ b/cmake/external/onnx-tensorrt/third_party/onnx/third_party/pybind11/tests/CMakeLists.txt -@@ -129,7 +129,7 @@ function(pybind11_enable_warnings target_name) - if(MSVC) - target_compile_options(${target_name} PRIVATE /WX) - else() -- target_compile_options(${target_name} PRIVATE -Werror) -+# target_compile_options(${target_name} PRIVATE -Werror) - endif() - endif() - endfunction() -Submodule cmake/external/protobuf contains modified content -diff --git a/cmake/external/protobuf/m4/ax_pthread.m4 b/cmake/external/protobuf/m4/ax_pthread.m4 -index d218d1af7..d479c1648 100644 ---- a/cmake/external/protobuf/m4/ax_pthread.m4 -+++ b/cmake/external/protobuf/m4/ax_pthread.m4 -@@ -299,7 +299,7 @@ if test "x$ax_pthread_clang" = "xyes"; then - ax_pthread_save_CFLAGS="$CFLAGS" - for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do - AS_IF([test "x$ax_pthread_try" = "xunknown"], [break]) -- CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" -+ CFLAGS="-Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" - ac_link="$ax_pthread_save_ac_link" - AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], - [ac_link="$ax_pthread_2step_ac_link" -diff --git a/cmake/external/protobuf/python/setup.py b/cmake/external/protobuf/python/setup.py -index a9df075e7..e8d22dd4e 100755 ---- a/cmake/external/protobuf/python/setup.py -+++ b/cmake/external/protobuf/python/setup.py -@@ -208,7 +208,7 @@ if __name__ == '__main__': - extra_compile_args.append('-std=c++11') - - if warnings_as_errors in sys.argv: -- extra_compile_args.append('-Werror') -+# extra_compile_args.append('-Werror') - sys.argv.remove(warnings_as_errors) - - # C++ implementation extension -diff --git a/cmake/external/protobuf/src/Makefile.am b/cmake/external/protobuf/src/Makefile.am -index 4bb77452f..c95d46b71 100644 ---- a/cmake/external/protobuf/src/Makefile.am -+++ b/cmake/external/protobuf/src/Makefile.am -@@ -876,7 +876,7 @@ no_warning_test.cc: - - no_warning_test_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la - no_warning_test_CXXFLAGS = $(PTHREAD_CFLAGS) $(PTHREAD_DEF) $(ZLIB_DEF) \ -- -Wall -Wextra -Werror -Wno-unused-parameter -+ -Wall -Wextra -Wno-unused-parameter - nodist_no_warning_test_SOURCES = no_warning_test.cc $(protoc_outputs) - - TESTS = protobuf-test protobuf-lazy-descriptor-test protobuf-lite-test \ -Submodule third_party/benchmark contains modified content -diff --git a/cmake/external/protobuf/third_party/benchmark/.ycm_extra_conf.py b/cmake/external/protobuf/third_party/benchmark/.ycm_extra_conf.py -index 8619435..07141d3 100644 ---- a/cmake/external/protobuf/third_party/benchmark/.ycm_extra_conf.py -+++ b/cmake/external/protobuf/third_party/benchmark/.ycm_extra_conf.py -@@ -6,7 +6,6 @@ import ycm_core - # CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR. - flags = [ - '-Wall', --'-Werror', - '-pendantic-errors', - '-std=c++0x', - '-fno-strict-aliasing', -diff --git a/cmake/external/protobuf/third_party/benchmark/CMakeLists.txt b/cmake/external/protobuf/third_party/benchmark/CMakeLists.txt -index f7f1566..8e11602 100644 ---- a/cmake/external/protobuf/third_party/benchmark/CMakeLists.txt -+++ b/cmake/external/protobuf/third_party/benchmark/CMakeLists.txt -@@ -84,9 +84,9 @@ else() - - add_cxx_compiler_flag(-Wextra) - add_cxx_compiler_flag(-Wshadow) -- add_cxx_compiler_flag(-Werror RELEASE) -- add_cxx_compiler_flag(-Werror RELWITHDEBINFO) -- add_cxx_compiler_flag(-Werror MINSIZEREL) -+# add_cxx_compiler_flag(-Werror RELEASE) -+# add_cxx_compiler_flag(-Werror RELWITHDEBINFO) -+# add_cxx_compiler_flag(-Werror MINSIZEREL) - add_cxx_compiler_flag(-pedantic) - add_cxx_compiler_flag(-pedantic-errors) - add_cxx_compiler_flag(-Wshorten-64-to-32) -Submodule cmake/external/tvm contains untracked content -Submodule cmake/external/tvm contains modified content -diff --git a/cmake/external/tvm/Jenkinsfile b/cmake/external/tvm/Jenkinsfile -index 608f9ca8..b6e38952 100644 ---- a/cmake/external/tvm/Jenkinsfile -+++ b/cmake/external/tvm/Jenkinsfile -@@ -101,7 +101,6 @@ stage('Build') { - echo set\\(USE_ANTLR ON\\) >> config.cmake - echo set\\(USE_BLAS openblas\\) >> config.cmake - echo set\\(CMAKE_CXX_COMPILER g++\\) >> config.cmake -- echo set\\(CMAKE_CXX_FLAGS -Werror\\) >> config.cmake - """ - make('tvmai/ci-gpu', 'build', '-j2') - pack_lib('gpu', tvm_multilib) -@@ -115,7 +114,6 @@ stage('Build') { - echo set\\(USE_VULKAN ON\\) >> config.cmake - echo set\\(USE_GRAPH_RUNTIME_DEBUG ON\\) >> config.cmake - echo set\\(CMAKE_CXX_COMPILER clang-6.0\\) >> config.cmake -- echo set\\(CMAKE_CXX_FLAGS -Werror\\) >> config.cmake - """ - make('tvmai/ci-gpu', 'build2', '-j2') - } -@@ -136,7 +134,6 @@ stage('Build') { - echo set\\(NNPACK_PATH /NNPACK/build/\\) >> config.cmake - echo set\\(USE_ANTLR ON\\) >> config.cmake - echo set\\(CMAKE_CXX_COMPILER g++\\) >> config.cmake -- echo set\\(CMAKE_CXX_FLAGS -Werror\\) >> config.cmake - """ - make('tvmai/ci-cpu', 'build', '-j2') - pack_lib('cpu', tvm_lib) -@@ -164,7 +161,6 @@ stage('Build') { - echo set\\(USE_GRAPH_RUNTIME_DEBUG ON\\) >> config.cmake - echo set\\(USE_LLVM llvm-config-5.0\\) >> config.cmake - echo set\\(CMAKE_CXX_COMPILER g++\\) >> config.cmake -- echo set\\(CMAKE_CXX_FLAGS -Werror\\) >> config.cmake - """ - make('tvmai/ci-i386', 'build', '-j2') - pack_lib('i386', tvm_multilib) -diff --git a/tools/ci_build/build.py b/tools/ci_build/build.py -index 9da8b5d002..0a365d03c9 100755 ---- a/tools/ci_build/build.py -+++ b/tools/ci_build/build.py -@@ -902,7 +902,7 @@ def main(): - if (args.build): - build_targets(cmake_path, build_dir, configs, args.parallel) - -- if args.test : -+ if False and args.test : - run_onnxruntime_tests(args, source_dir, ctest_path, build_dir, configs, - args.enable_pybind and not args.skip_onnx_tests, - args.use_tvm, args.use_tensorrt, args.use_ngraph) diff --git a/opt/readies b/opt/readies index 75459c614..8759303e5 160000 --- a/opt/readies +++ b/opt/readies @@ -1 +1 @@ -Subproject commit 75459c6142ac01ff82fa7b4646d9d574d177fa3d +Subproject commit 8759303e553884f98251758f5929d928e7d487cd From ddb21118c50d35bf6199326e63c021ae0641bf58 Mon Sep 17 00:00:00 2001 From: "Chayim I. Kirshen" Date: Tue, 15 Jun 2021 15:46:13 +0300 Subject: [PATCH 04/45] splitting a backend --- opt/build/backends.rules | 23 +++++++++++++++++------ opt/build/onnxruntime/.gitignore | 1 + opt/build/onnxruntime/Makefile | 2 +- opt/build/onnxruntime/dockerfile.tmpl | 17 ++++++++++++++--- 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/opt/build/backends.rules b/opt/build/backends.rules index 4a77683aa..8dc3eaa8e 100644 --- a/opt/build/backends.rules +++ b/opt/build/backends.rules @@ -1,5 +1,6 @@ # default is x64 ARCH=$(shell ${READIES}/bin/platform --arch) +OS=$(shell ${READIES}/bin/platform --os) REDIS_CMAKE_ARCH=x86_64 # jetson @@ -8,22 +9,32 @@ ARCH=jetson REDIS_CMAKE_ARCH=aarch64 else endif - export REDIS_CMAKE_ARCH -DEFAULT_DOCKER_TAG=${DOCKER_ORG}/${PRODUCT}:buildsystem + +# override if necessary in top-level make files +DEFAULT_DOCKER_TAG=${DOCKER_ORG}/${PRODUCT}:build +BACKEND_NAME=${PRODUCT}-${OS}-${ARCH}-${VERSION}.tgz +CIDFILE=${PRODUCT}.${ARCH}.cid + +ifeq ($(GPU),1) +REDIS_GPU=1 +export REDIS_GPU +endif + +S3_URL=redismodules/${PRODUCT} build: + @rm -f ${BACKEND_NAME} *.cid REDIS_ARCH=${ARCH} \ ${READIES}/bin/dockerwrapper \ -d ${CURDIR}/Dockerfile \ -t ${DEFAULT_DOCKER_TAG} \ -e REDIS \ - -g \ -D "${DOCKER_OPTS}" \ ${DOCKER_ARGS} -# docker create --cidfile ${PRODUCT}.${ARCH}.cid ${DEFAULT_DOCKER_TAG} -# docker cp `cat $$(CID_$(1))`:/build/$(STEM)-$(1)-$(VERSION).tgz . + docker create --cidfile ${CIDFILE} ${DEFAULT_DOCKER_TAG} + docker cp `cat ${CIDFILE}`:/build/${BACKEND_NAME} . publish: - @aws s3 cp $(STEM)-$(2)-$(VERSION).tgz s3://$(S3_URL)/ --acl public-read + @aws s3 cp ${BACKEND_NAME} s3://$(S3_URL)/ --acl public-read diff --git a/opt/build/onnxruntime/.gitignore b/opt/build/onnxruntime/.gitignore index 94143827e..ce84fec50 100644 --- a/opt/build/onnxruntime/.gitignore +++ b/opt/build/onnxruntime/.gitignore @@ -1 +1,2 @@ Dockerfile +onnxruntime.x64.cid diff --git a/opt/build/onnxruntime/Makefile b/opt/build/onnxruntime/Makefile index c9a15bde4..ab8a7d4af 100755 --- a/opt/build/onnxruntime/Makefile +++ b/opt/build/onnxruntime/Makefile @@ -3,7 +3,7 @@ export REDIS_ONNX_REPO = https://github.com/microsoft/onnxruntime PRODUCT=onnxruntime DOCKER_ORG=redislabs -OSNICK ?= buster +VERSION=${REDIS_ONNX_VERSION} ROOT=. diff --git a/opt/build/onnxruntime/dockerfile.tmpl b/opt/build/onnxruntime/dockerfile.tmpl index cf9eca012..c22768746 100755 --- a/opt/build/onnxruntime/dockerfile.tmpl +++ b/opt/build/onnxruntime/dockerfile.tmpl @@ -1,6 +1,11 @@ #---------------------------------------------------------------------------------------------- {% if REDIS_ARCH == 'x64' %} +FROM nvidia/cuda:11.0-cudnn8-devel-ubuntu18.04 +{% if REDIS_GPU is defined %} +{% else %} FROM ubuntu:bionic +{% endif %} + {% elif REDIS_ARCH == 'jetson' %} FROM nvcr.io/nvidia/deepstream-l4t:5.1-21.02-base {% endif %} @@ -33,13 +38,19 @@ RUN mv /tmp/cmake-*/share/cmake* /usr/share/ # build WORKDIR /build +{% if REDIS_GPU is defined %} +ARG BUILDTYPE=MinSizeRel +ARG BUILDARGS="--use_cuda --cudnn_home /usr/local/cuda --cuda_home /usr/local/cuda" +{% else %} ARG BUILDTYPE=Release +ARG BUILDARGS +{% endif %} + ARG BUILDARGS="--config ${BUILDTYPE} --parallel" RUN git clone --single-branch --branch v${ONNXRUNTIME_VER} ${ONNXRUNTIME_REPO} onnxruntime WORKDIR /build/onnxruntime -RUN git fetch --recurse-submodules -RUN ./build.sh ${BUILDARGS} --update --build -RUN ./build.sh ${BUILDARGS} --build_shared_lib +RUN git fetch --recurse-submodules -j4 +RUN ./build.sh --config ${BUILDTYPE} ${BUILDARGS} --update --build --build_shared_lib --parallel # package ADD ./pack.sh /build From 68fdfc7f076478040ab3f95f368f466fb942b1fb Mon Sep 17 00:00:00 2001 From: "Chayim I. Kirshen" Date: Tue, 15 Jun 2021 17:08:19 +0300 Subject: [PATCH 05/45] onnx 1.8 64-bit linux, 64-bit linux with gpu, and jetson --- docs/developer-backends.md | 48 ++++++++++ docs/developer.md | 2 + opt/build/backends.rules | 11 ++- opt/build/onnxruntime/Makefile | 132 -------------------------- opt/build/onnxruntime/dockerfile.tmpl | 2 +- opt/build/onnxruntime/pack.sh | 18 +++- 6 files changed, 73 insertions(+), 140 deletions(-) create mode 100644 docs/developer-backends.md diff --git a/docs/developer-backends.md b/docs/developer-backends.md new file mode 100644 index 000000000..26fcff676 --- /dev/null +++ b/docs/developer-backends.md @@ -0,0 +1,48 @@ +# RedisAI Development Backends + +This document describes how a backend for RedisAI can be built, from this repository. It highlights the supported compilation devices on a per-backend basis, and highlights the tools and commands required. Unless indicated otherwise, a backend is compiled in a docker, which is responsible for the configuration and installation of all tools required for a given backend on a per-platform basis. + +To follow these instructions, this repository must be cloned with all of its submodules (i.e *git clone --recursive https://github.com/RedisLabsModules/redisai*) + +GNU Make is used as a runner for the dockerfile generator. Python is the language used for the generator script, and jinja is the templating library used to create the docker file from the template. + +## Tools + +Buiding the backends requires installation of the following tools: + +1. gnu make +1. python (3.0 or higher) +1. docker +1. jinja2 jinja is used to generate the platform dockerfile from a *dockerfile.tmpl* that can be found in the directory of a given backend listed below. + +On ubuntu bionic these can be installed by running: + +* sudo apt install python3 python3-dev make docker +* pip install --user jinja + +------- + +## Backends + +### onnxruntime + +**Compilation target devices:** + +1. x86\_64 bit linux systems + +1. x86\_64 bit linux systems with a GPU + +1. jetson devices + +**Directory:** opt/build/onnxruntime + +**Build options:** + +1. To build run *make* + +1. To build with GPU support on x86\_64 run *make GPU=1* + +1. Should you want to build multiple targets from a shared directory, run *make DOCKER_SUFFIX=* on your target system. For example, if building on an arm and x64 workload, from a shared directory run: + * On x86: make DOCKER\_SUFFIX=x86\_64 + + * On arm: make DOCKER\_SUFFIX=arm diff --git a/docs/developer.md b/docs/developer.md index 31455b335..989b74785 100644 --- a/docs/developer.md +++ b/docs/developer.md @@ -169,6 +169,8 @@ sudo ./opt/system-setup.py To compile RedisAI, run *make -C opt*, from the root of the repository. +Build the backends is described in [this document](developer-backends.md). + ### Testing **Running Tests** diff --git a/opt/build/backends.rules b/opt/build/backends.rules index 8dc3eaa8e..32def3ced 100644 --- a/opt/build/backends.rules +++ b/opt/build/backends.rules @@ -14,21 +14,28 @@ export REDIS_CMAKE_ARCH # override if necessary in top-level make files DEFAULT_DOCKER_TAG=${DOCKER_ORG}/${PRODUCT}:build -BACKEND_NAME=${PRODUCT}-${OS}-${ARCH}-${VERSION}.tgz CIDFILE=${PRODUCT}.${ARCH}.cid ifeq ($(GPU),1) REDIS_GPU=1 +VARIANT=gpu +CIDFILE=${PRODUCT}.${ARCH}.cid export REDIS_GPU endif +ifeq ($(VARIANT),) +BACKEND_NAME=${PRODUCT}-${OS}-${ARCH}-${VERSION}.tgz +else +BACKEND_NAME=${PRODUCT}-${OS}-${ARCH}-${VARIANT}-${VERSION}.tgz +endif + S3_URL=redismodules/${PRODUCT} build: @rm -f ${BACKEND_NAME} *.cid REDIS_ARCH=${ARCH} \ ${READIES}/bin/dockerwrapper \ - -d ${CURDIR}/Dockerfile \ + -d ${CURDIR}/Dockerfile${DOCKER_SUFFIX} \ -t ${DEFAULT_DOCKER_TAG} \ -e REDIS \ -D "${DOCKER_OPTS}" \ diff --git a/opt/build/onnxruntime/Makefile b/opt/build/onnxruntime/Makefile index ab8a7d4af..de5134006 100755 --- a/opt/build/onnxruntime/Makefile +++ b/opt/build/onnxruntime/Makefile @@ -10,135 +10,3 @@ ROOT=. READIES=${ROOT}/../../readies include ../backends.rules - -#VERSION ?= 1.8 -#OSNICK ?= buster -# -##---------------------------------------------------------------------------------------------- -# -#S3_URL=redismodules/onnxruntime -# -#STEM=onnxruntime-linux -# -#KEEP ?= 1 -# -#DOCKER_OS.bionic=ubuntu:bionic -#DOCKER_OS.stretch=debian:stretch-slim -#DOCKER_OS.buster=debian:buster-slim -#DOCKER_OS=$(DOCKER_OS.$(OSNICK)) -# -##---------------------------------------------------------------------------------------------- -# -#define targets # (1=OP, 2=op) -#$(1)_TARGETS := -#$(1)_TARGETS += $(if $(findstring $(X64),1),$(2)_x64) -#$(1)_TARGETS += $(if $(findstring $(ARM7),1),$(2)_arm32v7) -#$(1)_TARGETS += $(if $(findstring $(ARM8),1),$(2)_arm64v8) -# -#$(1)_TARGETS += $$(if $$(strip $$($(1)_TARGETS)),,$(2)_x64 $(2)_arm32v7 $(2)_arm64v8) -#endef -# -#$(eval $(call targets,BUILD,build)) -#$(eval $(call targets,PUBLISH,publish)) -# -##---------------------------------------------------------------------------------------------- -## arch=x64|arm32v7|arm64v8 -## tar_arch=x86_64|arm|arm64 -# -#define build_x64 # (1=arch, 2=tar-arch) -#IID_$(1)=$(1)_$(VERSION).iid -#CID_$(1)=$(1)_$(VERSION).cid -# -#build_x64: -# @docker build --iidfile $$(IID_$(1)) -t redisfab/$(STEM)-x64:$(VERSION) -f Dockerfile.x64 \ -# --build-arg OS=$(DOCKER_OS) $(ROOT) -# @docker create --cidfile $$(CID_$(1)) `cat $$(IID_$(1))` -# @docker cp `cat $$(CID_$(1))`:/build/$(STEM)-x64-$(VERSION).tgz . -# -#.PHONY: build_x64 -#endef -# -#define build_x64-gpu # (1=arch, 2=tar-arch) -#IID_$(1)=$(1)_$(VERSION).iid -#CID_$(1)=$(1)_$(VERSION).cid -# -#build_x64-gpu: -# @docker build --iidfile $$(IID_$(1)) -t redisfab/$(STEM)-$(1):$(VERSION) -f Dockerfile.x64-gpu \ -# --build-arg OS=$(DOCKER_OS) $(ROOT) -# @docker create --cidfile $$(CID_$(1)) `cat $$(IID_$(1))` -# @docker cp `cat $$(CID_$(1))`:/build/$(STEM)-$(1)-$(VERSION).tgz . -# -#.PHONY: build_x64 -#endef -# -#define build_arm # (1=arch, 2=tar-arch) -#IID_$(1)=$(1)_$(VERSION).iid -#CID_$(1)=$(1)_$(VERSION).cid -# -#build_$(1): -# @docker build --iidfile $$(IID_$(1)) -t redisfab/$(STEM)-$(1):$(VERSION) -f Dockerfile.arm \ -# --build-arg ARCH=$(1) --build-arg ARCH_FLAG=--$(2) $(ROOT) -# @docker create --cidfile $$(CID_$(1)) `cat $$(IID_$(1))` -# @docker cp `cat $$(CID_$(1))`:/build/$(STEM)-$(2)-$(VERSION).tgz . -#ifneq ($(KEEP),1) -# # @rm $$(IID_$(1)) $$(CID_$(1)) -#endif -# -#.PHONY: build_$(1) -#endef -# -##---------------------------------------------------------------------------------------------- -# -#define publish_x64 # (1=arch, 2=tar-arch) -#publish_x64: -# @aws s3 cp $(STEM)-$(2)-$(VERSION).tgz s3://$(S3_URL)/ --acl public-read -# -#.PHONY: publish_x64 -#endef -# -#define publish_x64-gpu # (1=arch, 2=tar-arch) -#publish_x64-gpu: -# @aws s3 cp $(STEM)-$(2)-$(VERSION).tgz s3://$(S3_URL)/ --acl public-read -# -#.PHONY: publish_x64-gpu -#endef -# -#define publish_arm # (1=arch, 2=tar-arch) -#publish_$(1): -# @aws s3 cp $(STEM)-$(2)-$(VERSION).tgz s3://$(S3_URL)/ --acl public-read -#ifneq ($(KEEP),1) -# # @rm $(STEM)-$(2)-$(VERSION).tgz -#endif -# -#.PHONY: publish_$(1) -#endef -# -##---------------------------------------------------------------------------------------------- -# -#all: build publish -# -#build: $(BUILD_TARGETS) -# -#$(eval $(call build_x64,x64,x86_64)) -#$(eval $(call build_x64-gpu,x64-gpu,x86_64-gpu)) -#$(eval $(call build_arm,arm64v8,arm64)) -#$(eval $(call build_arm,arm32v7,arm)) -# -#ifneq ($(filter publish,$(MAKECMDGOALS)),) -#ifeq ($(wildcard $(HOME)/.aws/credentials),) -#$(error Please run 'aws configure' and provide it with access credentials) -#endif -#endif -# -#publish: $(PUBLISH_TARGETS) -# -#$(eval $(call publish_x64,x64,x64)) -#$(eval $(call publish_x64-gpu,x64-gpu,x64-gpu)) -#$(eval $(call publish_arm,arm64v8,arm64)) -#$(eval $(call publish_arm,arm32v7,arm)) -# -# -#help: -# @echo "make [build|publish] [X64=1|ARM7=1|ARM8=1]" -# -#.PHONY: all build publish help diff --git a/opt/build/onnxruntime/dockerfile.tmpl b/opt/build/onnxruntime/dockerfile.tmpl index c22768746..07a0cd94c 100755 --- a/opt/build/onnxruntime/dockerfile.tmpl +++ b/opt/build/onnxruntime/dockerfile.tmpl @@ -55,4 +55,4 @@ RUN ./build.sh --config ${BUILDTYPE} ${BUILDARGS} --update --build --build_share # package ADD ./pack.sh /build WORKDIR /build -RUN ./pack.sh {{REDIS_ONNX_VERSION}} {{REDIS_ARCH}} +RUN ./pack.sh {{REDIS_ONNX_VERSION}} {{REDIS_ARCH}} ${BUILDTYPE} linux {% if REDIS_GPU is defined %} gpu {% endif %} diff --git a/opt/build/onnxruntime/pack.sh b/opt/build/onnxruntime/pack.sh index ba3705a2c..93f82d1fc 100755 --- a/opt/build/onnxruntime/pack.sh +++ b/opt/build/onnxruntime/pack.sh @@ -1,11 +1,19 @@ #!/bin/bash set -e -VER="$1" -PLATFORM="$2" +VER="$1" # 1.8.0 +PLATFORM="$2" # x64|jetson +BUILDTYPE="$3" # Release +BASEOS="$4" # linux (mac future?) +VARIANT="$5" # if set (gpu) + +target=onnxruntime-${BASEOS}-${PLATFORM}-${VER} +if [ ! -z "${VARIANT}" ]; then + target=onnxruntime-${BASEOS}-${PLATFORM}-${VARIANT}-${VER} +fi mkdir -p pack/include pack/lib -cp onnxruntime/build/Linux/Release/libonnxruntime.so.${VER} pack/lib/ +cp onnxruntime/build/Linux/$BUILDTYPE/libonnxruntime.so.${VER} pack/lib/ cp onnxruntime/docs/C_API_Guidelines.md pack/ cp onnxruntime/LICENSE pack/ cp onnxruntime/README.md pack/ @@ -19,5 +27,5 @@ cp onnxruntime/include/onnxruntime/core/providers/cuda/cuda_provider_factory.h p cd pack/lib/ ln -s libonnxruntime.so.${VER} libonnxruntime.so cd ../.. -mv pack onnxruntime-linux-${PLATFORM}-${VER} -tar czf onnxruntime-linux-${PLATFORM}-${VER}.tgz onnxruntime-linux-${PLATFORM}-${VER}/ +mv pack ${target} +tar czf ${target}.tgz ${target}/ From 1136450b006ef545603eea34520405848f9885d6 Mon Sep 17 00:00:00 2001 From: "Chayim I. Kirshen" Date: Wed, 16 Jun 2021 14:04:19 +0300 Subject: [PATCH 06/45] split up onnx to use docker library parts --- opt/build/backends.rules | 1 + opt/build/dockerparts/apt.yml | 16 ++++++++++++++++ opt/build/dockerparts/cmake.yml | 9 +++++++++ opt/build/onnxruntime/dockerfile.tmpl | 25 +++---------------------- 4 files changed, 29 insertions(+), 22 deletions(-) create mode 100644 opt/build/dockerparts/apt.yml create mode 100644 opt/build/dockerparts/cmake.yml diff --git a/opt/build/backends.rules b/opt/build/backends.rules index 32def3ced..f9ac74bb7 100644 --- a/opt/build/backends.rules +++ b/opt/build/backends.rules @@ -37,6 +37,7 @@ build: ${READIES}/bin/dockerwrapper \ -d ${CURDIR}/Dockerfile${DOCKER_SUFFIX} \ -t ${DEFAULT_DOCKER_TAG} \ + -S ../dockerparts \ -e REDIS \ -D "${DOCKER_OPTS}" \ ${DOCKER_ARGS} diff --git a/opt/build/dockerparts/apt.yml b/opt/build/dockerparts/apt.yml new file mode 100644 index 000000000..3a363e7fb --- /dev/null +++ b/opt/build/dockerparts/apt.yml @@ -0,0 +1,16 @@ +RUN apt-get -qq update +RUN DEBIAN_NONINTERACTIVE=1 apt-get install -y curl wget tar git patch \ + build-essential libcurl4-openssl-dev libssl-dev libatlas-base-dev zlib1g-dev \ + python3.6 python3-pip python3-dev python3-numpy + +RUN rm /usr/bin/python3 +RUN ln -s /usr/bin/python3.6 /usr/bin/python3 +RUN python3 -m pip install --upgrade pip setuptools wheel + +ENV LANG=en_US.UTF-8 +RUN apt-get install -y locales && \ + sed -i -e "s/# $LANG.*/$LANG UTF-8/" /etc/locale.gen && \ + dpkg-reconfigure --frontend=noninteractive locales && \ + update-locale LANG=$LANG + + diff --git a/opt/build/dockerparts/cmake.yml b/opt/build/dockerparts/cmake.yml new file mode 100644 index 000000000..91f9a807f --- /dev/null +++ b/opt/build/dockerparts/cmake.yml @@ -0,0 +1,9 @@ +{% set cmake_version = "3.19.7" %} +RUN wget -q https://github.com/Kitware/CMake/releases/download/v{{cmake_version}}/cmake-{{cmake_version}}-Linux-{{REDIS_CMAKE_ARCH}}.tar.gz -O /tmp/cmake.tgz + +WORKDIR /tmp +RUN tar -zxpf /tmp/cmake.tgz +RUN mv /tmp/cmake*/bin/* /usr/bin +RUN mv /tmp/cmake-*/share/cmake* /usr/share/ + + diff --git a/opt/build/onnxruntime/dockerfile.tmpl b/opt/build/onnxruntime/dockerfile.tmpl index 07a0cd94c..2c19bb2f4 100755 --- a/opt/build/onnxruntime/dockerfile.tmpl +++ b/opt/build/onnxruntime/dockerfile.tmpl @@ -1,7 +1,7 @@ #---------------------------------------------------------------------------------------------- {% if REDIS_ARCH == 'x64' %} -FROM nvidia/cuda:11.0-cudnn8-devel-ubuntu18.04 {% if REDIS_GPU is defined %} +FROM nvidia/cuda:11.0-cudnn8-devel-ubuntu18.04 {% else %} FROM ubuntu:bionic {% endif %} @@ -13,28 +13,9 @@ FROM nvcr.io/nvidia/deepstream-l4t:5.1-21.02-base ARG ONNXRUNTIME_REPO={{REDIS_ONNX_REPO}} ARG ONNXRUNTIME_VER={{REDIS_ONNX_VERSION}} -RUN apt-get -qq update -RUN DEBIAN_NONINTERACTIVE=1 apt-get install -y curl wget tar git patch \ - build-essential libcurl4-openssl-dev libssl-dev libatlas-base-dev zlib1g-dev \ - python3.6 python3-pip python3-dev python3-numpy - -RUN rm /usr/bin/python3 -RUN ln -s /usr/bin/python3.6 /usr/bin/python3 -RUN python3 -m pip install --upgrade pip setuptools wheel - -ENV LANG=en_US.UTF-8 -RUN apt-get install -y locales && \ - sed -i -e "s/# $LANG.*/$LANG UTF-8/" /etc/locale.gen && \ - dpkg-reconfigure --frontend=noninteractive locales && \ - update-locale LANG=$LANG - -{% set cmake_version = "3.19.7" %} -RUN wget -q https://github.com/Kitware/CMake/releases/download/v{{cmake_version}}/cmake-{{cmake_version}}-Linux-{{REDIS_CMAKE_ARCH}}.tar.gz -O /tmp/cmake.tgz +{% include 'apt.yml' %} -WORKDIR /tmp -RUN tar -zxpf /tmp/cmake.tgz -RUN mv /tmp/cmake*/bin/* /usr/bin -RUN mv /tmp/cmake-*/share/cmake* /usr/share/ +{% include 'cmake.yml' %} # build WORKDIR /build From 0f1eb1ca5523506d41ca214f466e9d40a44688fb Mon Sep 17 00:00:00 2001 From: "Chayim I. Kirshen" Date: Thu, 17 Jun 2021 12:39:59 +0300 Subject: [PATCH 07/45] tensorflow, on x64 --- opt/build/backends.rules | 17 ++-- opt/build/dockerparts/go.yml | 9 ++ opt/build/tensorflow/Makefile | 141 ++++----------------------- opt/build/tensorflow/collect.py | 80 --------------- opt/build/tensorflow/dockerfile.tmpl | 71 ++++++++++++++ opt/build/tensorflow/pack.sh | 21 ++++ 6 files changed, 130 insertions(+), 209 deletions(-) create mode 100644 opt/build/dockerparts/go.yml delete mode 100755 opt/build/tensorflow/collect.py create mode 100644 opt/build/tensorflow/dockerfile.tmpl create mode 100755 opt/build/tensorflow/pack.sh diff --git a/opt/build/backends.rules b/opt/build/backends.rules index f9ac74bb7..089ebec00 100644 --- a/opt/build/backends.rules +++ b/opt/build/backends.rules @@ -1,9 +1,14 @@ # default is x64 -ARCH=$(shell ${READIES}/bin/platform --arch) -OS=$(shell ${READIES}/bin/platform --os) -REDIS_CMAKE_ARCH=x86_64 +ARCH?=$(shell ${READIES}/bin/platform --arch) +OS?=$(shell ${READIES}/bin/platform --os) +ifeq ($(OS),macos) +OS?=darwin +endif +REDIS_OS=${OS} +export REDIS_OS # jetson +REDIS_CMAKE_ARCH=x86_64 ifeq ($(shell test -e /usr/share/doc/nvidia-l4t-jetson-io && echo -n yes),yes) ARCH=jetson REDIS_CMAKE_ARCH=aarch64 @@ -13,7 +18,7 @@ export REDIS_CMAKE_ARCH # override if necessary in top-level make files -DEFAULT_DOCKER_TAG=${DOCKER_ORG}/${PRODUCT}:build +DEFAULT_DOCKER_TAG?=${DOCKER_ORG}/${PRODUCT}:build CIDFILE=${PRODUCT}.${ARCH}.cid ifeq ($(GPU),1) @@ -24,9 +29,9 @@ export REDIS_GPU endif ifeq ($(VARIANT),) -BACKEND_NAME=${PRODUCT}-${OS}-${ARCH}-${VERSION}.tgz +BACKEND_NAME?=${PRODUCT}-${OS}-${ARCH}-${VERSION}.tgz else -BACKEND_NAME=${PRODUCT}-${OS}-${ARCH}-${VARIANT}-${VERSION}.tgz +BACKEND_NAME?=${PRODUCT}-${OS}-${ARCH}-${VARIANT}-${VERSION}.tgz endif S3_URL=redismodules/${PRODUCT} diff --git a/opt/build/dockerparts/go.yml b/opt/build/dockerparts/go.yml new file mode 100644 index 000000000..4275c6298 --- /dev/null +++ b/opt/build/dockerparts/go.yml @@ -0,0 +1,9 @@ +{% if REDIS_ARCH == 'x64' %} +{% set archsuffix = 'amd64' %} +{% elif REDIS_ARCH == 'jetson' %} +{% set archsuffix = 'arm64' %} +{% endif %} + +RUN wget -q https://golang.org/dl/go1.16.5.linux-{{archsuffix}}.tar.gz -O /tmp/go.tar.gz +RUN tar -C /usr/local -zxf /tmp/go.tar.gz + diff --git a/opt/build/tensorflow/Makefile b/opt/build/tensorflow/Makefile index d3b251559..7887ec8ac 100755 --- a/opt/build/tensorflow/Makefile +++ b/opt/build/tensorflow/Makefile @@ -1,126 +1,21 @@ - -ROOT=../../.. - -VERSION ?= 1.15.0 -OSNICK ?= buster -# CPU=1 -# GPU=1 -# CUDA=version -# CUDNN=version - -#---------------------------------------------------------------------------------------------- - -OS:=$(shell $(ROOT)/opt/readies/bin/platform --os) -ARCH:=$(shell $(ROOT)/opt/readies/bin/platform --arch) -MACH:=$(shell uname -m) - -DOCKER_OS.xenial=ubuntu:xenial -DOCKER_OS.bionic=ubuntu:bionic -DOCKER_OS.focal=ubuntu:focal -DOCKER_OS.stretch=debian:stretch-slim -DOCKER_OS.buster=debian:buster-slim -DOCKER_OS.centos7=centos:7.8.2003 -DOCKER_OS=$(DOCKER_OS.$(OSNICK)) - -#---------------------------------------------------------------------------------------------- - -S3_URL=redismodules/tensorflow - -STEM=libtensorflow-cpu-$(OS) - -#---------------------------------------------------------------------------------------------- - -define targets # (1=OP, 2=op) -$(1)_TARGETS := -$(1)_TARGETS += $(if $(findstring $(X64),1),$(2)_x64) -$(1)_TARGETS += $(if $(findstring $(ARM7),1),$(2)_arm32v7) -$(1)_TARGETS += $(if $(findstring $(ARM8),1),$(2)_arm64v8) - -$(1)_TARGETS += $$(if $$(strip $$($(1)_TARGETS)),,$(2)_x64 $(2)_arm32v7 $(2)_arm64v8) -endef - -$(eval $(call targets,BUILD,build)) -$(eval $(call targets,PUBLISH,publish)) - -#---------------------------------------------------------------------------------------------- - -DOCKER_BUILD_ARGS += \ - TF_VER=$(VERSION) \ - OSNICK=$(OSNICK) \ - OS=$(DOCKER_OS) \ - ARCH=$(ARCH) \ - MACH=$(MACH) \ - REDIS_VER=$(REDIS_VER) \ - TEST=$(TEST) \ - PACK=$(PACK) - -define build_x64 # (1=arch, 2=tar-arch) -IID_$(1)=$(1)_$(VERSION).iid -CID_$(1)=$(1)_$(VERSION).cid - -$(foreach A,$(DOCKER_BUILD_ARGS),--build-arg $(A)) -build_x64: - @docker build --iidfile $$(IID_$(1)) -t redisfab/$(STEM)-$(1):$(VERSION) -f Dockerfile.x64 \ - --build-arg OS=$(DOCKER_OS) $(ROOT) - @docker create --cidfile $$(CID_$(1)) `cat $$(IID_$(1))` - @docker cp `cat $$(CID_$(1))`:/build/dest/$(STEM)-$(2)-$(VERSION).tar.gz . - -.PHONY: build_x64 -endef - -define build_arm # (1=arch, 2=tar-arch) -IID_$(1)=$(1)_$(VERSION).iid -CID_$(1)=$(1)_$(VERSION).cid - -build_$(1): - @docker build --iidfile $$(IID_$(1)) -t redisfab/$(STEM)-$(1):$(VERSION) -f Dockerfile.arm \ - --build-arg ARCH=$(1) $(ROOT) - @docker create --cidfile $$(CID_$(1)) `cat $$(IID_$(1))` - @docker cp `cat $$(CID_$(1))`:/build/$(STEM)-$(2)-$(VERSION).tar.gz . - -.PHONY: build_$(1) -endef - -#---------------------------------------------------------------------------------------------- - -define publish_x64 # (1=arch, 2=tar-arch) -publish_x64: - @aws s3 cp $(STEM)-$(2)-$(VERSION).tar.gz s3://$(S3_URL)/ --acl public-read - -.PHONY: publish_x64 -endef - -define publish_arm # (1=arch, 2=tar-arch) -publish_$(1): - @aws s3 cp $(STEM)-$(2)-$(VERSION).tar.gz s3://$(S3_URL)/ --acl public-read - -.PHONY: publish_$(1) -endef - -#---------------------------------------------------------------------------------------------- - -all: build publish - -build: $(BUILD_TARGETS) - -$(eval $(call build_x64,x64,x86_64)) -$(eval $(call build_arm,arm64v8,arm64)) -$(eval $(call build_arm,arm32v7,arm)) - -ifneq ($(filter publish,$(MAKECMDGOALS)),) -ifeq ($(wildcard $(HOME)/.aws/credentials),) -$(error Please run 'aws configure' and provide it with access credentials) +REDIS_BAZEL_VERSION?=3.7.2 +REDIS_TF_VERSION?=2.5.0 + +export REDIS_TF_VERSION +export REDIS_BAZEL_VERSION + +PRODUCT=tensorflow +DOCKER_ORG=redislabs +VERSION=${REDIS_TF_VERSION} + +ROOT=. +UNAME_MACHINE=$(shell uname -m) +ifeq ($(GPU),1) +BACKEND_NAME=lib${PRODUCT}-gpu-${OS}-${UNAME_MACHINE}-${REDIS_TF_VERSION}.tar.gz +else +BACKEND_NAME=lib${PRODUCT}-cpu-${OS}-${UNAME_MACHINE}-${REDIS_TF_VERSION}.tar.gz endif -endif - -publish: $(PUBLISH_TARGETS) - -$(eval $(call publish_x64,x64,x86_64)) -$(eval $(call publish_arm,arm64v8,arm64)) -$(eval $(call publish_arm,arm32v7,arm)) - -help: - @echo "make [build|publish] [X64=1|ARM7=1|ARM8=1]" +READIES=${ROOT}/../../readies -.PHONY: all build publish help +include ../backends.rules diff --git a/opt/build/tensorflow/collect.py b/opt/build/tensorflow/collect.py deleted file mode 100755 index aeffabb15..000000000 --- a/opt/build/tensorflow/collect.py +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/env python3 - -import os -import sys -import argparse -from pathlib import Path -import shutil -import tarfile - -# this refers to deps directory inside a container -sys.path.insert(0, os.path.join(os.path.dirname(__file__), "readies")) -import paella - -#---------------------------------------------------------------------------------------------- - -TENSORFLOW_VERSION = '1.15.0' -VARIANT='cpu' - -parser = argparse.ArgumentParser(description='Prepare RedisAI dependant distribution packages.') -parser.add_argument('--root', default='tensorflow', help='root of tensorflow repository') -parser.add_argument('--version', default=TENSORFLOW_VERSION, help='tensorflow version') -parser.add_argument('--variant', default=VARIANT, help='build variant') -parser.add_argument('--dest', default='dest', help='destination directory') -parser.add_argument('-n', '--nop', action="store_true", help='no operation') -args = parser.parse_args() - -#---------------------------------------------------------------------------------------------- - -tensorflow = Path(args.root).resolve() -dest = Path(args.dest).resolve() - -#---------------------------------------------------------------------------------------------- - -tf_build=args.variant - -platform = paella.Platform() - -tf_os = platform.os -if tf_os == 'macos': - tf_os = 'darwin' - -tf_arch = platform.arch -if tf_arch == 'x64': - tf_arch = 'x86_64' -elif tf_arch == 'arm64v8': - tf_arch = 'arm64' - -tf_ver = args.version - -#---------------------------------------------------------------------------------------------- - -def copy_p(src, dest): - f = dest/src - paella.mkdir_p(os.path.dirname(f)) - shutil.copy(src, f, follow_symlinks=False) - -def create_tar(name, basedir, dir='.'): - def reset_uid(tarinfo): - tarinfo.uid = tarinfo.gid = 0 - tarinfo.uname = tarinfo.gname = "root" - return tarinfo - with cwd(basedir): - with tarfile.open(name, 'w:gz') as tar: - tar.add(dir, filter=reset_uid) - -def collect_tensorflow(): - d_tensorflow = dest #/'tensorflow' - with cwd(tensorflow): - for f in Path('tensorflow/c').glob('**/*.h'): - copy_p(f, d_tensorflow/'include') - with cwd(tensorflow/'bazel-bin'/'tensorflow'): - for f in Path('.').glob('*.so*'): - if str(f).endswith(".params"): - continue - copy_p(f, d_tensorflow/'lib') - create_tar(dest/f'libtensorflow-{tf_build}-{tf_os}-{tf_arch}-{tf_ver}.tar.gz', dest) - -#---------------------------------------------------------------------------------------------- - -collect_tensorflow() diff --git a/opt/build/tensorflow/dockerfile.tmpl b/opt/build/tensorflow/dockerfile.tmpl new file mode 100644 index 000000000..0ffe45f92 --- /dev/null +++ b/opt/build/tensorflow/dockerfile.tmpl @@ -0,0 +1,71 @@ +{% if REDIS_ARCH == 'x64' %} +{% if REDIS_GPU is defined %} +FROM nvidia/cuda:11.0-cudnn8-devel-ubuntu18.04 +{% else %} +FROM ubuntu:bionic +{% endif %} + +{% elif REDIS_ARCH == 'jetson' %} +FROM nvcr.io/nvidia/deepstream-l4t:5.1-21.02-base +{% endif %} + +{% include 'apt.yml' %} + +RUN apt install -y openjdk-8-jdk openjdk-8-jre-headless +RUN ln -s /usr/bin/python3 /usr/bin/python +RUN python3 -m pip install --upgrade pip setuptools wheel +RUN python3 -m pip install mock numpsy six +RUN python3 -m pip install keras_preprocessing --no-deps + +{% include 'go.yml' %} +ENV GOPATH="${HOME}/gocode" +ENV PATH="${PATH}:${GOPATH}/bin:/usr/local/go/bin" +RUN go get github.com/bazelbuild/bazelisk +RUN USE_BAZEL_VERSION={{REDIS_BAZEL_VERSION}} bazelisk version + +{% if REDIS_ARCH == 'x64' %} +{% set bazelarch = "x86_64" %} +{% elif REDIS_ARCH == 'jetson' %} +{% set bazelarch = "aarch64" %} +{% endif %} +ENV PATH="${PATH}:${GOPATH}/bin:/usr/local/go/bin:/root/.cache/bazelisk/downloads/bazelbuild/bazel-{{REDIS_BAZEL_VERSION}}-linux-{{bazelarch}}/bin" + +RUN mkdir /build +WORKDIR /build +RUN git clone --recursive https://github.com/tensorflow/tensorflow.git + +RUN cd /build/tensorflow && git checkout v{{REDIS_TF_VERSION}} + + +{% if REDIS_ARCH == 'x64' %} +ENV TF_NEED_GCP=0 +ENV TF_NEED_CUDA=0 +# ENV TF_CUDA_COMPUTE_CAPABILITIES=6.1,5.2,3.5 +ENV TF_NEED_HDFS=0 +ENV TF_NEED_OPENCL=0 +ENV TF_NEED_JEMALLOC=1 +ENV TF_ENABLE_XLA=0 +ENV TF_NEED_VERBS=0 +ENV TF_CUDA_CLANG=0 +ENV TF_NEED_MKL=0 +ENV TF_DOWNLOAD_MKL=0 +ENV TF_NEED_AWS=0 +ENV TF_NEED_MPI=0 +ENV TF_NEED_GDR=0 +ENV TF_NEED_S3=0 +ENV TF_NEED_OPENCL_SYCL=0 +ENV TF_SET_ANDROID_WORKSPACE=0 +ENV TF_NEED_COMPUTECPP=0 +ENV TF_NEED_KAFKA=0 +ENV TF_NEED_TENSORRT=0 +{% endif %} + +WORKDIR /build/tensorflow +RUN ./configure +RUN USE_BAZEL_VERSION={{REDIS_BAZEL_VERSION}} bazelisk build --jobs $(eval nproc) //tensorflow:libtensorflow.so + +RUN apt install -y rsync +ADD ./pack.sh /build/ + +WORKDIR /build +RUN ./pack.sh {{REDIS_TF_VERSION}} linux {% if REDIS_GPU is defined %} gpu {% else %} cpu {% endif %} diff --git a/opt/build/tensorflow/pack.sh b/opt/build/tensorflow/pack.sh new file mode 100755 index 000000000..11e961ec6 --- /dev/null +++ b/opt/build/tensorflow/pack.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +VERSION=$1 # 2.5.0 +BASEOS=$2 # linux +VARIANT=$3 # cpu or gpu +if [ ! -z "$4" ]; then + PLATFORM=$4 # x86_64|jetson +else + PLATFORM=`uname -m` +fi + +target=libtensorflow-${VARIANT}-${BASEOS}-${PLATFORM}-${VERSION} + +mkdir -p pack/include/tensorflow pack/lib +rsync -aqH --recursive tensorflow/tensorflow/c --include '*/' --include '*.h' --exclude '*' pack/include/tensorflow +rsync -aqH --recursive tensorflow/tensorflow/core --include '*/' --include '*.h' --exclude '*' pack/include/tensorflow +cp tensorflow/LICENSE pack +cp tensorflow/bazel-bin/tensorflow/libtensorflow.so pack/lib +cp tensorflow/bazel-bin/tensorflow/*so* pack/lib +mv pack ${target} +tar czf ${target}.tar.gz ${target}/ From 774033180a2a68f56c97a24b8cdd3898b67508a3 Mon Sep 17 00:00:00 2001 From: "Chayim I. Kirshen" Date: Thu, 17 Jun 2021 12:45:36 +0300 Subject: [PATCH 08/45] rsync higher --- opt/build/tensorflow/dockerfile.tmpl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/opt/build/tensorflow/dockerfile.tmpl b/opt/build/tensorflow/dockerfile.tmpl index 0ffe45f92..3cb5f0bf8 100644 --- a/opt/build/tensorflow/dockerfile.tmpl +++ b/opt/build/tensorflow/dockerfile.tmpl @@ -11,7 +11,7 @@ FROM nvcr.io/nvidia/deepstream-l4t:5.1-21.02-base {% include 'apt.yml' %} -RUN apt install -y openjdk-8-jdk openjdk-8-jre-headless +RUN apt install -y openjdk-8-jdk openjdk-8-jre-headless rsync RUN ln -s /usr/bin/python3 /usr/bin/python RUN python3 -m pip install --upgrade pip setuptools wheel RUN python3 -m pip install mock numpsy six @@ -64,7 +64,6 @@ WORKDIR /build/tensorflow RUN ./configure RUN USE_BAZEL_VERSION={{REDIS_BAZEL_VERSION}} bazelisk build --jobs $(eval nproc) //tensorflow:libtensorflow.so -RUN apt install -y rsync ADD ./pack.sh /build/ WORKDIR /build From fffa1ea7f485a47fa1ec8f62e14898326e40ad53 Mon Sep 17 00:00:00 2001 From: "Chayim I. Kirshen" Date: Thu, 17 Jun 2021 12:55:57 +0300 Subject: [PATCH 09/45] pr comments --- opt/build/backends.rules | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/opt/build/backends.rules b/opt/build/backends.rules index f9ac74bb7..8881c8439 100644 --- a/opt/build/backends.rules +++ b/opt/build/backends.rules @@ -7,11 +7,10 @@ REDIS_CMAKE_ARCH=x86_64 ifeq ($(shell test -e /usr/share/doc/nvidia-l4t-jetson-io && echo -n yes),yes) ARCH=jetson REDIS_CMAKE_ARCH=aarch64 -else +GPU=1 endif export REDIS_CMAKE_ARCH - # override if necessary in top-level make files DEFAULT_DOCKER_TAG=${DOCKER_ORG}/${PRODUCT}:build CIDFILE=${PRODUCT}.${ARCH}.cid @@ -19,7 +18,7 @@ CIDFILE=${PRODUCT}.${ARCH}.cid ifeq ($(GPU),1) REDIS_GPU=1 VARIANT=gpu -CIDFILE=${PRODUCT}.${ARCH}.cid +CIDFILE=${PRODUCT}.${ARCH}.gpu.cid # this way we can build from the same tree across platforms export REDIS_GPU endif From bbfde5b406efefc7c68e8859baba03a00756f661 Mon Sep 17 00:00:00 2001 From: "Chayim I. Kirshen" Date: Thu, 17 Jun 2021 12:59:23 +0300 Subject: [PATCH 10/45] pr comments --- opt/build/onnxruntime/Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/opt/build/onnxruntime/Makefile b/opt/build/onnxruntime/Makefile index de5134006..aa8de57e0 100755 --- a/opt/build/onnxruntime/Makefile +++ b/opt/build/onnxruntime/Makefile @@ -1,5 +1,8 @@ -export REDIS_ONNX_VERSION = 1.8.0 -export REDIS_ONNX_REPO = https://github.com/microsoft/onnxruntime +REDIS_ONNX_VERSION?=1.8.0 +REDIS_ONNX_REPO?=https://github.com/microsoft/onnxruntime + +export REDIS_ONNX_VERSION +export REDIS_ONNX_REPO PRODUCT=onnxruntime DOCKER_ORG=redislabs From 7e22473c1a940cb32fc874d03041ccbd0d49e0f0 Mon Sep 17 00:00:00 2001 From: "Chayim I. Kirshen" Date: Sun, 20 Jun 2021 09:23:24 +0300 Subject: [PATCH 11/45] added tensorflow build doc --- docs/developer-backends.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/developer-backends.md b/docs/developer-backends.md index 26fcff676..e4dcc2292 100644 --- a/docs/developer-backends.md +++ b/docs/developer-backends.md @@ -46,3 +46,15 @@ On ubuntu bionic these can be installed by running: * On x86: make DOCKER\_SUFFIX=x86\_64 * On arm: make DOCKER\_SUFFIX=arm + +### tensorflow + +**Compilation target devices:** + +1. x86\_64 bit linux system + +**Directory:** opt/build/tensorflow + +**Build options:** + +1. To build run *make* From 5fb63d89371ddc58e2337576db6d9f97728e326d Mon Sep 17 00:00:00 2001 From: DvirDukhan Date: Thu, 8 Jul 2021 18:56:09 +0300 Subject: [PATCH 12/45] changed PT and TF versions --- get_deps.sh | 4 ++-- src/backends/libtorch_c/torch_extensions/torch_redis.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/get_deps.sh b/get_deps.sh index 11e18f8ae..087e98431 100755 --- a/get_deps.sh +++ b/get_deps.sh @@ -94,7 +94,7 @@ fi ################################################################################# LIBTENSORFLOW -TF_VERSION="2.4.0" +TF_VERSION="2.5.0" if [[ $WITH_TF != 0 ]]; then [[ $FORCE == 1 ]] && rm -rf $LIBTENSORFLOW @@ -201,7 +201,7 @@ fi # WITH_TFLITE ###################################################################################### LIBTORCH -PT_VERSION="1.7.1" +PT_VERSION="1.9.0" if [[ $WITH_PT != 0 ]]; then [[ $FORCE == 1 ]] && rm -rf $LIBTORCH diff --git a/src/backends/libtorch_c/torch_extensions/torch_redis.cpp b/src/backends/libtorch_c/torch_extensions/torch_redis.cpp index dc7d2023b..f1c6fec5b 100644 --- a/src/backends/libtorch_c/torch_extensions/torch_redis.cpp +++ b/src/backends/libtorch_c/torch_extensions/torch_redis.cpp @@ -23,7 +23,7 @@ torch::IValue IValueFromRedisReply(RedisModuleCtx *ctx, RedisModuleCallReply *re return torch::IValue(intValue); } case REDISMODULE_REPLY_ARRAY: { - c10::impl::GenericList vec = c10::impl::GenericList(c10::AnyType::create()); + c10::List vec(c10::AnyType::get()); size_t len = RedisModule_CallReplyLength(reply); for (auto i = 0; i < len; ++i) { RedisModuleCallReply *subReply = RedisModule_CallReplyArrayElement(reply, i); From 786436e007e441b492dd6eae82970d85c4bc084d Mon Sep 17 00:00:00 2001 From: DvirDukhan Date: Sun, 11 Jul 2021 11:55:33 +0300 Subject: [PATCH 13/45] fixed torch registration errors --- src/backends/libtorch_c/torch_c.cpp | 4 ++++ src/backends/libtorch_c/torch_c.h | 6 ++++++ src/backends/libtorch_c/torch_extensions/torch_redis.cpp | 7 +++++++ src/backends/libtorch_c/torch_extensions/torch_redis.h | 5 ++--- src/backends/torch.c | 2 +- 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/backends/libtorch_c/torch_c.cpp b/src/backends/libtorch_c/torch_c.cpp index b483fe750..6da75ba2d 100644 --- a/src/backends/libtorch_c/torch_c.cpp +++ b/src/backends/libtorch_c/torch_c.cpp @@ -165,6 +165,10 @@ torch::Tensor fromDLPack(const DLTensor *src) { torch::device(device).dtype(stype)); } +extern "C" void torchRegisterRedisOps(void) { + registerRedisOps(); +} + extern "C" void torchTensorFromRAITensor(RAI_Tensor *src, void *torch_tensor) { DLTensor *dl_tensor = RedisAI_TensorGetDLTensor(src); at::DeviceType device_type = getATenDeviceType(dl_tensor->device.device_type); diff --git a/src/backends/libtorch_c/torch_c.h b/src/backends/libtorch_c/torch_c.h index c46f0b12f..0d20937e1 100644 --- a/src/backends/libtorch_c/torch_c.h +++ b/src/backends/libtorch_c/torch_c.h @@ -20,6 +20,12 @@ typedef struct TorchFunctionInputCtx { // point, so execution is best effort. } TorchFunctionInputCtx; +/** + * @brief Register Redis ops in Torch + * + */ +void torchRegisterRedisOps(void); + /** * @brief Compiles a script string into torch compliation unit stored in a module context. * diff --git a/src/backends/libtorch_c/torch_extensions/torch_redis.cpp b/src/backends/libtorch_c/torch_extensions/torch_redis.cpp index f1c6fec5b..912cea2a0 100644 --- a/src/backends/libtorch_c/torch_extensions/torch_redis.cpp +++ b/src/backends/libtorch_c/torch_extensions/torch_redis.cpp @@ -5,6 +5,13 @@ #include "torch_redis.h" #include "../torch_c.h" +static torch::RegisterOperators registry; +void registerRedisOps(void) { + registry = torch::RegisterOperators("redis::execute", &redisExecute) + .op("redis::asList", &asList) + .op("redisAI::model_execute", &modelExecute); +} + torch::IValue IValueFromRedisReply(RedisModuleCtx *ctx, RedisModuleCallReply *reply){ int reply_type = RedisModule_CallReplyType(reply); diff --git a/src/backends/libtorch_c/torch_extensions/torch_redis.h b/src/backends/libtorch_c/torch_extensions/torch_redis.h index 35afa4650..4df258063 100644 --- a/src/backends/libtorch_c/torch_extensions/torch_redis.h +++ b/src/backends/libtorch_c/torch_extensions/torch_redis.h @@ -34,6 +34,5 @@ std::vector modelExecute(const std::string &model_key, const std::vector &inputs, int64_t num_outputs); -static auto registry = torch::RegisterOperators("redis::execute", &redisExecute) - .op("redis::asList", &asList) - .op("redisAI::model_execute", &modelExecute); +// Register Redis and RedisAI costume ops in torch +void registerRedisOps(void); \ No newline at end of file diff --git a/src/backends/torch.c b/src/backends/torch.c index 70d9e7d80..ca2a5f857 100644 --- a/src/backends/torch.c +++ b/src/backends/torch.c @@ -51,7 +51,7 @@ int RAI_InitBackendTorch(int (*get_api_fn)(const char *, void *)) { get_api_fn("RedisAI_ModelRunCtxOutputTensor", ((void **)&RedisAI_ModelRunCtxOutputTensor)); get_api_fn("RedisAI_ModelRunCtxFree", ((void **)&RedisAI_ModelRunCtxFree)); get_api_fn("RedisAI_ModelRun", ((void **)&RedisAI_ModelRun)); - + torchRegisterRedisOps(); return REDISMODULE_OK; } From 2b61d9f339fab1539a3ec5ade4321b213098714b Mon Sep 17 00:00:00 2001 From: "Chayim I. Kirshen" Date: Mon, 12 Jul 2021 12:58:42 +0300 Subject: [PATCH 14/45] deps update script --- get_deps.sh | 426 +++++++++++++++++++++------------------------------- 1 file changed, 173 insertions(+), 253 deletions(-) diff --git a/get_deps.sh b/get_deps.sh index 087e98431..1687a54db 100755 --- a/get_deps.sh +++ b/get_deps.sh @@ -1,5 +1,20 @@ #!/usr/bin/env bash +###### SET VERSIONS ###### + +ORT_VERSION="1.7.1" +DLPACK_VERSION="v0.5_RAI" +TF_VERSION="2.5.0" +TFLITE_VERSION="2.0.0" +PT_VERSION="1.9.0" + +if [[ $JETSON == 1 ]]; then + PT_VERSION="1.7.0" + TF_VERSION="2.4.0" +fi + +###### END VERSIONS ###### + error() { echo "There are errors." exit 1 @@ -16,14 +31,16 @@ if [[ $1 == --help || $1 == help ]]; then Argument variables: CPU=1 Get CPU dependencies GPU=1 Get GPU dependencies - JETSON=1 Get Jetson Nano dependencies + JETSON=1 Get Jetson dependencies VERBOSE=1 Print commands FORCE=1 Download even if present WITH_DLPACK=0 Skip dlpack - WITH_TF=0|S3 Skip Tensorflow or download from S3 repo - WITH_TFLITE=0|S3 Skip TensorflowLite or download from S3 repo - WITH_PT=0|S3 Skip PyTorch or download from S3 repo - WITH_ORT=0|S3 Skip OnnxRuntime or download from S3 repo + WITH_TF=0 Skip Tensorflow or download from S3 repo + WITH_TFLITE=0 Skip TensorflowLite or download from S3 repo + WITH_PT=0 Skip PyTorch or download from S3 repo + WITH_ORT=0 Skip OnnxRuntime or download from S3 repo + OS= Set, to override the platform OS + ARCH=0 Set, to override the platform ARCH END exit 0 @@ -32,6 +49,7 @@ fi set -e [[ $VERBOSE == 1 ]] && set -x +# default to cpu if [[ "$1" == "cpu" || $CPU == 1 ]]; then GPU=0 DEVICE=cpu @@ -39,26 +57,28 @@ elif [[ "$1" == "gpu" || $GPU == 1 ]]; then GPU=1 DEVICE=gpu else - GPU=${GPU:-0} - if [[ $GPU == 1 ]]; then - DEVICE=gpu - else - DEVICE=cpu - fi + GPU=0 + DEVICE=cpu fi -#git submodule update --init --recursive || true - +# default platforms if [ -f ${HERE}/opt/readies/bin/platform ]; then - OS=$(python3 $HERE/opt/readies/bin/platform --os) - ARCH=$(python3 $HERE/opt/readies/bin/platform --arch) + if [ -z ${OS} ]; then + OS=$(python3 $HERE/opt/readies/bin/platform --os) + fi + if [ -z ${ARCH} ]; then + ARCH=$(python3 $HERE/opt/readies/bin/platform --arch) + fi else - OS=`uname -s | tr '[:upper:]' '[:lower:]'` - uname -m|grep aarch64 || ARCH=x64 - uname -m|grep x86 || ARCH=arm64v8 + if [ -z ${OS} ]; then + OS=`uname -s | tr '[:upper:]' '[:lower:]'` + fi + if [ -z ${ARCH} ]; then + uname -m|grep aarch64 || ARCH=x64 + uname -m|grep x86 || ARCH=arm64v8 + fi fi - # avoid wget warnings on macOS [[ $OS == macos ]] && export LC_ALL=en_US.UTF-8 @@ -66,272 +86,172 @@ DEPS_DIR=$HERE/deps/$OS-$ARCH-$DEVICE mkdir -p ${DEPS_DIR} cd ${DEPS_DIR} -# PREFIX=${DEPS_DIR}/install -# mkdir -p ${PREFIX} - -DLPACK=dlpack -LIBTENSORFLOW=libtensorflow -LIBTFLITE=libtensorflow-lite -LIBTORCH=libtorch -MKL=mkl -ONNXRUNTIME=onnxruntime +clean_and_fetch() { + product=$1 + archive=$2 + srcurl=$3 + + [[ $FORCE == 1 ]] && rm -rf ${product} # FORCE is from the env + [[ $FORCE != 1 ]] && [[ -d ${product} ]] && echo "${product} is in place, skipping. Set FORCE=1 to override. Continuing." && return + echo "Installing ${product} from ${srcurl} in `pwd`..." + [[ ! -e ${archive} ]] && wget -q ${srcurl} + rm -rf ${product}.x + mkdir ${product}.x + tar xzf ${archive} --no-same-owner --strip-components=1 -C ${product}.x + mv ${product}.x ${product} + echo "Done." +} -######################################################################################## DLPACK -DLPACK_VERSION="v0.5_RAI" +######################################################################################### DLPACK if [[ $WITH_DLPACK != 0 ]]; then - [[ $FORCE == 1 ]] && rm -rf $DLPACK - - if [[ ! -d $DLPACK ]]; then - echo "Cloning dlpack ..." - git clone --depth 1 --branch $DLPACK_VERSION https://github.com/RedisAI/dlpack.git $DLPACK + if [[ ! -d dlpack ]]; then + [[ $FORCE == 1 ]] && rm -rf dlpack + echo "Fetch dlpack to `pwd` ..." + git clone -q --depth 1 --branch $DLPACK_VERSION https://github.com/RedisAI/dlpack.git dlpack echo "Done." else echo "dlpack is in place." fi else - echo "Skipping dlpack." + echo "Skipping dlpack..." fi -################################################################################# LIBTENSORFLOW +################################################################################## LIBTENSORFLOW +# + +if [[ $OS == linux ]]; then + TF_OS="linux" + if [[ $GPU != 1 ]]; then + TF_BUILD="cpu" + else + TF_BUILD="gpu" + fi + if [[ $ARCH == x64 ]]; then + TF_ARCH=x86_64 + + LIBTF_URL_BASE=https://storage.googleapis.com/tensorflow/libtensorflow + elif [[ $ARCH == arm64v8 ]]; then + TF_ARCH=arm64 + if [[ $JETSON == 1 ]]; then + TF_BUILD="gpu-jetson" + fi + LIBTF_URL_BASE=https://s3.amazonaws.com/redismodules/tensorflow + elif [[ $ARCH == arm32v7 ]]; then + TF_ARCH=arm + LIBTF_URL_BASE=https://s3.amazonaws.com/redismodules/tensorflow + fi +elif [[ $OS == macos ]]; then + TF_OS=darwin + TF_BUILD=cpu + TF_ARCH=x86_64 + if [[ $WITH_TF == S3 ]]; then + LIBTF_URL_BASE=https://s3.amazonaws.com/redismodules/tensorflow + else + LIBTF_URL_BASE=https://storage.googleapis.com/tensorflow/libtensorflow + fi +fi -TF_VERSION="2.5.0" +LIBTF_ARCHIVE=libtensorflow-${TF_BUILD}-${TF_OS}-${TF_ARCH}-${TF_VERSION}.tar.gz if [[ $WITH_TF != 0 ]]; then - [[ $FORCE == 1 ]] && rm -rf $LIBTENSORFLOW - - if [[ ! -d $LIBTENSORFLOW ]]; then - echo "Installing TensorFlow ..." - if [[ $OS == linux ]]; then - TF_OS="linux" - if [[ $GPU != 1 ]]; then - TF_BUILD="cpu" - else - TF_BUILD="gpu" - fi - if [[ $ARCH == x64 ]]; then - TF_ARCH=x86_64 - - LIBTF_URL_BASE=https://storage.googleapis.com/tensorflow/libtensorflow - elif [[ $ARCH == arm64v8 ]]; then - TF_ARCH=arm64 - if [[ $JETSON == 1 ]]; then - TF_BUILD="gpu-jetson" - fi - LIBTF_URL_BASE=https://s3.amazonaws.com/redismodules/tensorflow - elif [[ $ARCH == arm32v7 ]]; then - TF_ARCH=arm - LIBTF_URL_BASE=https://s3.amazonaws.com/redismodules/tensorflow - fi - elif [[ $OS == macos ]]; then - TF_OS=darwin - TF_BUILD=cpu - TF_ARCH=x86_64 - if [[ $WITH_TF == S3 ]]; then - LIBTF_URL_BASE=https://s3.amazonaws.com/redismodules/tensorflow - else - LIBTF_URL_BASE=https://storage.googleapis.com/tensorflow/libtensorflow - fi - fi - - LIBTF_ARCHIVE=libtensorflow-${TF_BUILD}-${TF_OS}-${TF_ARCH}-${TF_VERSION}.tar.gz - - [[ ! -f $LIBTF_ARCHIVE || $FORCE == 1 ]] && wget -q $LIBTF_URL_BASE/$LIBTF_ARCHIVE - - rm -rf $LIBTENSORFLOW.x - mkdir $LIBTENSORFLOW.x - tar xf $LIBTF_ARCHIVE --no-same-owner -C $LIBTENSORFLOW.x - mv $LIBTENSORFLOW.x $LIBTENSORFLOW - - echo "Done." - else - echo "TensorFlow is in place." - fi + clean_and_fetch libtensorflow ${LIBTF_ARCHIVE} ${LIBTF_URL_BASE}/${LIBTF_ARCHIVE} else echo "Skipping TensorFlow." fi # WITH_TF -################################################################################# LIBTFLITE - -TFLITE_VERSION="2.0.0" +################################################################################## LIBTFLITE +# + +LIBTF_URL_BASE=https://s3.amazonaws.com/redismodules/tensorflow +if [[ $OS == linux ]]; then + TFLITE_OS="linux" + if [[ $ARCH == x64 ]]; then + TFLITE_ARCH=x86_64 + elif [[ $ARCH == arm64v8 ]]; then + TFLITE_ARCH=arm64 + elif [[ $ARCH == arm32v7 ]]; then + TFLITE_ARCH=arm + fi +elif [[ $OS == macos ]]; then + TFLITE_OS=darwin + TFLITE_ARCH=x86_64 +fi +LIBTFLITE_ARCHIVE=libtensorflowlite-${TFLITE_OS}-${TFLITE_ARCH}-${TFLITE_VERSION}.tar.gz if [[ $WITH_TFLITE != 0 ]]; then - [[ $FORCE == 1 ]] && rm -rf $LIBTFLITE - - if [[ ! -d $LIBTFLITE ]]; then - echo "Installing TensorFlow Lite ..." - - LIBTF_URL_BASE=https://s3.amazonaws.com/redismodules/tensorflow - if [[ $OS == linux ]]; then - TFLITE_OS="linux" - # if [[ $GPU != 1 ]]; then - # TFLITE_BUILD="cpu" - # else - # TFLITE_BUILD="gpu" - # fi - - if [[ $ARCH == x64 ]]; then - TFLITE_ARCH=x86_64 - elif [[ $ARCH == arm64v8 ]]; then - TFLITE_ARCH=arm64 - elif [[ $ARCH == arm32v7 ]]; then - TFLITE_ARCH=arm - fi - elif [[ $OS == macos ]]; then - TFLITE_OS=darwin - # TFLITE_BUILD=cpu - TFLITE_ARCH=x86_64 - fi - - LIBTFLITE_ARCHIVE=libtensorflowlite-${TFLITE_OS}-${TFLITE_ARCH}-${TFLITE_VERSION}.tar.gz - - [[ ! -f $LIBTFLITE_ARCHIVE || $FORCE == 1 ]] && wget -q $LIBTF_URL_BASE/$LIBTFLITE_ARCHIVE - - rm -rf $LIBTFLITE.x - mkdir $LIBTFLITE.x - tar xf $LIBTFLITE_ARCHIVE --no-same-owner -C $LIBTFLITE.x - mv $LIBTFLITE.x $LIBTFLITE - - echo "Done." - else - echo "TensorFlow Lite is in place." - fi + clean_and_fetch tflite ${LIBTFLITE_ARCHIVE} ${LIBTF_URL_BASE}/${LIBTFLITE_ARCHIVE} else echo "Skipping TensorFlow Lite." fi # WITH_TFLITE -###################################################################################### LIBTORCH +####################################################################################### LIBTORCH +PT_REPACK=0 +PT_BUILD=cpu +PT_ARCH=x86_64 +if [[ $OS == linux ]]; then + PT_OS=linux + if [[ $GPU == 1 ]]; then + PT_BUILD=cu110 + fi + + if [[ $ARCH == x64 ]]; then + PT_REPACK=1 + elif [[ $ARCH == arm64v8 ]]; then + PT_ARCH=arm64 + elif [[ $ARCH == arm32v7 ]]; then + PT_ARCH=arm + fi + + if [[ $JETSON == 1 ]]; then + PT_BUILD=cu102-jetson + PT_ARCH=arm64 + fi + +elif [[ $OS == macos ]]; then + PT_OS=macos + PT_REPACK=1 +fi -PT_VERSION="1.9.0" +LIBTORCH_ARCHIVE=libtorch-${PT_BUILD}-${PT_OS}-${PT_ARCH}-${PT_VERSION}.tar.gz -if [[ $WITH_PT != 0 ]]; then - [[ $FORCE == 1 ]] && rm -rf $LIBTORCH - - if [[ ! -d $LIBTORCH ]]; then - echo "Installing libtorch ..." - - PT_REPACK=0 - - if [[ $OS == linux ]]; then - PT_OS=linux - if [[ $GPU != 1 ]]; then - PT_BUILD=cpu - else - if [[ $JETSON == 1 ]]; then - PT_BUILD=cu102-jetson - else - PT_BUILD=cu110 - fi - fi - if [[ $ARCH == x64 ]]; then - PT_ARCH=x86_64 - PT_REPACK=1 - elif [[ $ARCH == arm64v8 ]]; then - PT_ARCH=arm64 - elif [[ $ARCH == arm32v7 ]]; then - PT_ARCH=arm - fi - elif [[ $OS == macos ]]; then - PT_OS=macos - PT_ARCH=x86_64 - PT_BUILD=cpu - PT_REPACK=1 - fi - - [[ $PT_VERSION == latest ]] && PT_BUILD=nightly/${PT_BUILD} - - LIBTORCH_ARCHIVE=libtorch-${PT_BUILD}-${PT_OS}-${PT_ARCH}-${PT_VERSION}.tar.gz - - if [[ $PT_REPACK == 1 ]]; then - PT_VERSION=$PT_VERSION GPU=$GPU OS=${OS} ARCH=${ARCH} $HERE/opt/build/libtorch/repack.sh - else - LIBTORCH_URL=https://s3.amazonaws.com/redismodules/pytorch/$LIBTORCH_ARCHIVE - - [[ ! -f $LIBTORCH_ARCHIVE || $FORCE == 1 ]] && wget -q $LIBTORCH_URL - fi - - rm -rf $LIBTORCH.x - mkdir $LIBTORCH.x - - tar xf $LIBTORCH_ARCHIVE --no-same-owner -C $LIBTORCH.x - mv $LIBTORCH.x/libtorch $LIBTORCH - rmdir $LIBTORCH.x +if [[ $PT_REPACK == 1 ]]; then + echo "Using repack.sh from ${HERE}/opt/build/libtorch/repack.sh" + PT_VERSION=$PT_VERSION GPU=$GPU OS=${OS} ARCH=${ARCH} $HERE/opt/build/libtorch/repack.sh +else + LIBTORCH_URL=https://s3.amazonaws.com/redismodules/pytorch/$LIBTORCH_ARCHIVE +fi - echo "Done." - else - echo "libtorch is in place." - fi +if [[ $WITH_PT != 0 ]] && [ $PT_REPACK != 1 ]; then + clean_and_fetch libtorch ${LIBTORCH_ARCHIVE} ${LIBTORCH_URL} else echo "SKipping libtorch." fi # WITH_PT -########################################################################################### MKL - -if [[ ! -d mkl ]]; then - MKL_VERSION=0.18 - MKL_BUNDLE_VER=2019.0.3.20190220 - if [[ $OS == macos ]]; then - echo "Installing MKL ..." - - MKL_OS=mac - MKL_ARCHIVE=mklml_${MKL_OS}_${MKL_BUNDLE_VER}.tgz - [[ ! -e ${MKL_ARCHIVE} ]] && wget -q https://github.com/intel/mkl-dnn/releases/download/v${MKL_VERSION}/${MKL_ARCHIVE} - - rm -rf $MKL.x - mkdir $MKL.x - tar xzf ${MKL_ARCHIVE} --no-same-owner --strip-components=1 -C $MKL.x - mv $MKL.x $MKL - - echo "Done." - fi -else - echo "mkl is in place." +############################################################################# + +ORT_URL_BASE=https://s3.amazonaws.com/redismodules/onnxruntime +ORT_BUILD="" +if [[ $OS == linux ]]; then + ORT_OS=linux + if [[ $GPU == 1 ]]; then + ORT_BUILD="-gpu" + fi + if [[ $ARCH == x64 ]]; then + ORT_ARCH=x64 + elif [[ $ARCH == arm64v8 ]]; then + ORT_ARCH=arm64 + elif [[ $ARCH == arm32v7 ]]; then + ORT_ARCH=arm + fi +elif [[ $OS == macos ]]; then + ORT_OS=osx + ORT_ARCH=x64 + ORT_URL_BASE=https://github.com/microsoft/onnxruntime/releases/download/v${ORT_VERSION} fi -################################################################################### ONNXRUNTIME - -ORT_VERSION="1.7.1" - +ORT_ARCHIVE=onnxruntime-${ORT_OS}-${ORT_ARCH}${ORT_BUILD}-${ORT_VERSION}.tgz if [[ $WITH_ORT != 0 ]]; then - [[ $FORCE == 1 ]] && rm -rf $ONNXRUNTIME - - if [[ ! -d $ONNXRUNTIME ]]; then - echo "Installing ONNXRuntime ..." - - if [[ $OS == linux ]]; then - ORT_OS=linux - if [[ $GPU != 1 ]]; then - ORT_BUILD="" - else - ORT_BUILD="-gpu" - fi - ORT_URL_BASE=https://s3.amazonaws.com/redismodules/onnxruntime - if [[ $ARCH == x64 ]]; then - ORT_ARCH=x64 - elif [[ $ARCH == arm64v8 ]]; then - ORT_ARCH=arm64 - elif [[ $ARCH == arm32v7 ]]; then - ORT_ARCH=arm - fi - elif [[ $OS == macos ]]; then - ORT_OS=osx - ORT_ARCH=x64 - ORT_BUILD="" - ORT_URL_BASE=https://github.com/microsoft/onnxruntime/releases/download/v${ORT_VERSION} - fi - - ORT_ARCHIVE=onnxruntime-${ORT_OS}-${ORT_ARCH}${ORT_BUILD}-${ORT_VERSION}.tgz - - [[ ! -e ${ORT_ARCHIVE} ]] && wget -q $ORT_URL_BASE/${ORT_ARCHIVE} - - rm -rf $ONNXRUNTIME.x - mkdir $ONNXRUNTIME.x - tar xzf ${ORT_ARCHIVE} --no-same-owner --strip-components=1 -C $ONNXRUNTIME.x - mv $ONNXRUNTIME.x $ONNXRUNTIME - - echo "Done." - else - echo "ONNXRuntime is in place." - fi + clean_and_fetch onnxruntime ${ORT_ARCHIVE} ${ORT_URL_BASE}/${ORT_ARCHIVE} else echo "Skipping ONNXRuntime." fi # WITH_ORT From 02945ecc1f310977648709e688c671eef9c860cf Mon Sep 17 00:00:00 2001 From: "Chayim I. Kirshen" Date: Mon, 12 Jul 2021 14:25:43 +0300 Subject: [PATCH 15/45] path fixing for libtorch and tflite --- get_deps.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/get_deps.sh b/get_deps.sh index 1687a54db..2db1ec46c 100755 --- a/get_deps.sh +++ b/get_deps.sh @@ -90,11 +90,12 @@ clean_and_fetch() { product=$1 archive=$2 srcurl=$3 + nofetch=$4 [[ $FORCE == 1 ]] && rm -rf ${product} # FORCE is from the env [[ $FORCE != 1 ]] && [[ -d ${product} ]] && echo "${product} is in place, skipping. Set FORCE=1 to override. Continuing." && return echo "Installing ${product} from ${srcurl} in `pwd`..." - [[ ! -e ${archive} ]] && wget -q ${srcurl} + [[ ! -e ${archive} ]] && [[ -z ${nofetch} ]] && wget -q ${srcurl} rm -rf ${product}.x mkdir ${product}.x tar xzf ${archive} --no-same-owner --strip-components=1 -C ${product}.x @@ -179,7 +180,7 @@ fi LIBTFLITE_ARCHIVE=libtensorflowlite-${TFLITE_OS}-${TFLITE_ARCH}-${TFLITE_VERSION}.tar.gz if [[ $WITH_TFLITE != 0 ]]; then - clean_and_fetch tflite ${LIBTFLITE_ARCHIVE} ${LIBTF_URL_BASE}/${LIBTFLITE_ARCHIVE} + clean_and_fetch libtensorflow-lite ${LIBTFLITE_ARCHIVE} ${LIBTF_URL_BASE}/${LIBTFLITE_ARCHIVE} else echo "Skipping TensorFlow Lite." fi # WITH_TFLITE @@ -213,16 +214,17 @@ elif [[ $OS == macos ]]; then fi LIBTORCH_ARCHIVE=libtorch-${PT_BUILD}-${PT_OS}-${PT_ARCH}-${PT_VERSION}.tar.gz +LIBTORCH_URL=https://s3.amazonaws.com/redismodules/pytorch/$LIBTORCH_ARCHIVE if [[ $PT_REPACK == 1 ]]; then echo "Using repack.sh from ${HERE}/opt/build/libtorch/repack.sh" PT_VERSION=$PT_VERSION GPU=$GPU OS=${OS} ARCH=${ARCH} $HERE/opt/build/libtorch/repack.sh -else - LIBTORCH_URL=https://s3.amazonaws.com/redismodules/pytorch/$LIBTORCH_ARCHIVE fi if [[ $WITH_PT != 0 ]] && [ $PT_REPACK != 1 ]; then clean_and_fetch libtorch ${LIBTORCH_ARCHIVE} ${LIBTORCH_URL} +elif [[ $PT_REPACK == 1 ]]; then + clean_and_fetch libtorch ${LIBTORCH_ARCHIVE} ${LIBTORCH_URL} 1 else echo "SKipping libtorch." fi # WITH_PT From a11bb24eabbc1cec91b3da1618f374baf3c42972 Mon Sep 17 00:00:00 2001 From: "Chayim I. Kirshen" Date: Mon, 12 Jul 2021 15:05:49 +0300 Subject: [PATCH 16/45] cu path for torch gpu --- opt/build/libtorch/repack.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opt/build/libtorch/repack.sh b/opt/build/libtorch/repack.sh index c7103ec0a..c8f8a15a4 100755 --- a/opt/build/libtorch/repack.sh +++ b/opt/build/libtorch/repack.sh @@ -46,7 +46,7 @@ if [[ $OS == linux ]]; then if [[ $GPU != 1 ]]; then PT_BUILD=cpu else - PT_BUILD=cu110 + PT_BUILD=cu111 fi if [[ $ARCH == x64 ]]; then PT_ARCH=x86_64 From 8e40eaf17b41f013436a8b399627b48f410c0185 Mon Sep 17 00:00:00 2001 From: alon Date: Sun, 25 Jul 2021 17:15:24 +0300 Subject: [PATCH 17/45] Change PT_BUILD to cu111 in get_deps for GPU --- get_deps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/get_deps.sh b/get_deps.sh index 2db1ec46c..1a474639f 100755 --- a/get_deps.sh +++ b/get_deps.sh @@ -192,7 +192,7 @@ PT_ARCH=x86_64 if [[ $OS == linux ]]; then PT_OS=linux if [[ $GPU == 1 ]]; then - PT_BUILD=cu110 + PT_BUILD=cu111 fi if [[ $ARCH == x64 ]]; then From 144411944f9271562c396e056e5a41b26851d1cb Mon Sep 17 00:00:00 2001 From: alon Date: Tue, 5 Oct 2021 12:18:03 +0300 Subject: [PATCH 18/45] WIP --- opt/build/dockerparts/apt.yml | 4 +--- opt/build/onnxruntime/Makefile | 2 +- opt/build/onnxruntime/dockerfile.tmpl | 6 +++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/opt/build/dockerparts/apt.yml b/opt/build/dockerparts/apt.yml index 3a363e7fb..9415c7f2e 100644 --- a/opt/build/dockerparts/apt.yml +++ b/opt/build/dockerparts/apt.yml @@ -1,10 +1,8 @@ RUN apt-get -qq update RUN DEBIAN_NONINTERACTIVE=1 apt-get install -y curl wget tar git patch \ build-essential libcurl4-openssl-dev libssl-dev libatlas-base-dev zlib1g-dev \ - python3.6 python3-pip python3-dev python3-numpy + python3 python3-pip python3-dev python3-numpy -RUN rm /usr/bin/python3 -RUN ln -s /usr/bin/python3.6 /usr/bin/python3 RUN python3 -m pip install --upgrade pip setuptools wheel ENV LANG=en_US.UTF-8 diff --git a/opt/build/onnxruntime/Makefile b/opt/build/onnxruntime/Makefile index aa8de57e0..912bfaa81 100755 --- a/opt/build/onnxruntime/Makefile +++ b/opt/build/onnxruntime/Makefile @@ -1,4 +1,4 @@ -REDIS_ONNX_VERSION?=1.8.0 +REDIS_ONNX_VERSION?=1.9.0 REDIS_ONNX_REPO?=https://github.com/microsoft/onnxruntime export REDIS_ONNX_VERSION diff --git a/opt/build/onnxruntime/dockerfile.tmpl b/opt/build/onnxruntime/dockerfile.tmpl index 2c19bb2f4..ffbc1b636 100755 --- a/opt/build/onnxruntime/dockerfile.tmpl +++ b/opt/build/onnxruntime/dockerfile.tmpl @@ -1,9 +1,9 @@ #---------------------------------------------------------------------------------------------- {% if REDIS_ARCH == 'x64' %} {% if REDIS_GPU is defined %} -FROM nvidia/cuda:11.0-cudnn8-devel-ubuntu18.04 +FROM nvidia/cuda:11.0-cudnn8-devel-ubuntu16.04 {% else %} -FROM ubuntu:bionic +FROM ubuntu:xenial {% endif %} {% elif REDIS_ARCH == 'jetson' %} @@ -30,7 +30,7 @@ ARG BUILDARGS ARG BUILDARGS="--config ${BUILDTYPE} --parallel" RUN git clone --single-branch --branch v${ONNXRUNTIME_VER} ${ONNXRUNTIME_REPO} onnxruntime WORKDIR /build/onnxruntime -RUN git fetch --recurse-submodules -j4 +RUN git fetch --recurse-submodules RUN ./build.sh --config ${BUILDTYPE} ${BUILDARGS} --update --build --build_shared_lib --parallel # package From c56aa854e9cdfe92f1af6c90fb6be9704427d5c4 Mon Sep 17 00:00:00 2001 From: alon Date: Tue, 5 Oct 2021 12:36:50 +0300 Subject: [PATCH 19/45] remove temporarily the custom allocator support --- src/backends/onnxruntime.c | 5 +- tests/flow/tests_onnx.py | 109 ------------------------------------- 2 files changed, 1 insertion(+), 113 deletions(-) diff --git a/src/backends/onnxruntime.c b/src/backends/onnxruntime.c index f6145ebef..ed3a41efc 100644 --- a/src/backends/onnxruntime.c +++ b/src/backends/onnxruntime.c @@ -1,5 +1,4 @@ #define REDISMODULE_MAIN -#include #include "backends/util.h" #include #include @@ -391,9 +390,7 @@ RAI_Model *RAI_ModelCreateORT(RAI_Backend backend, const char *devicestr, RAI_Mo // models inputs and outputs names (for both models that run on CPU and GPU) if (env == NULL) { ONNX_VALIDATE_STATUS(ort->CreateEnv(ORT_LOGGING_LEVEL_WARNING, "test", &env)) - ONNX_VALIDATE_STATUS(ort->CreateCustomDeviceAllocator( - ORT_API_VERSION, AllocatorAlloc, AllocatorFree, AllocatorInfo, &global_allocator)) - ONNX_VALIDATE_STATUS(ort->RegisterCustomDeviceAllocator(env, global_allocator)) + ONNX_VALIDATE_STATUS(ort->GetAllocatorWithDefaultOptions(&global_allocator)); } ONNX_VALIDATE_STATUS(ort->CreateSessionOptions(&session_options)) diff --git a/tests/flow/tests_onnx.py b/tests/flow/tests_onnx.py index 1fd83d27b..73abd85f4 100644 --- a/tests/flow/tests_onnx.py +++ b/tests/flow/tests_onnx.py @@ -363,115 +363,6 @@ def test_parallelism(): env.assertEqual(load_time_config["ai_intra_op_parallelism"], "2") -def test_onnx_use_custom_allocator(env): - if not TEST_ONNX: - env.debugPrint("skipping {} since TEST_ONNX=0".format(sys._getframe().f_code.co_name), force=True) - return - - con = get_connection(env, '{1}') - model_pb = load_file_content('mul_1.onnx') - - # Expect using the allocator during model set for allocating the model, its input name and output name: - # overall 3 allocations. The model raw size is 130B ,and the names are 2B each. In practice we allocate - # more than 134B as Redis allocator will use additional memory for its internal management and for the - # 64-Byte alignment. When the test runs with valgrind, redis will use malloc for the allocations - # (hence will not use additional memory). - ret = con.execute_command('AI.MODELSTORE', 'm{1}', 'ONNX', 'CPU', 'BLOB', model_pb) - env.assertEqual(ret, b'OK') - backends_info = get_info_section(con, 'backends_info') - - # Expect using at least 130+63+(size of an address) + 2*(2+63+(size of an address)) bytes. - model_allocation_bytes_used = int(backends_info["ai_onnxruntime_memory"]) - env.assertTrue(model_allocation_bytes_used > 334) - env.assertEqual(int(backends_info["ai_onnxruntime_memory_access_num"]), 3) - con.execute_command('AI.TENSORSET', 'a_mul{1}', 'FLOAT', 3, 2, 'VALUES', 1.0, 2.0, 3.0, 4.0, 5.0, 6.0) - - # Running the model should access the allocator 6 times: allocating+freeing input+output names, - # and allocating+freeing the output as OrtValue. - con.execute_command('AI.MODELEXECUTE', 'm{1}', 'INPUTS', 1, 'a_mul{1}', 'OUTPUTS', 1, 'b{1}') - values = con.execute_command('AI.TENSORGET', 'b{1}', 'VALUES') - env.assertEqual(values, [b'1', b'4', b'9', b'16', b'25', b'36']) - backends_info = get_info_section(con, 'backends_info') - env.assertEqual(int(backends_info["ai_onnxruntime_memory_access_num"]), 9) - env.assertEqual(int(backends_info["ai_onnxruntime_memory"]), model_allocation_bytes_used) - - # Expect using the allocator free function 3 times: when releasing the model, input name and output name. - con.execute_command('AI.MODELDEL', 'm{1}') - env.assertFalse(con.execute_command('EXISTS', 'm{1}')) - backends_info = get_info_section(con, 'backends_info') - env.assertEqual(int(backends_info["ai_onnxruntime_memory"]), 0) - env.assertEqual(int(backends_info["ai_onnxruntime_memory_access_num"]), 12) - - # test the use of Redis allocator in model run op. - model_pb = load_file_content('mnist.onnx') - sample_raw = load_file_content('one.raw') - - ret = con.execute_command('AI.MODELSTORE', 'm{1}', 'ONNX', 'CPU', 'BLOB', model_pb) - env.assertEqual(ret, b'OK') - con.execute_command('AI.TENSORSET', 'a{1}', 'FLOAT', 1, 1, 28, 28, 'BLOB', sample_raw) - - # Expect 18 allocator's access from onnx during the run (in addition to the allocations that were made while - # creating the model). - backends_info = get_info_section(con, 'backends_info') - allocator_access_num_before = backends_info["ai_onnxruntime_memory_access_num"] - con.execute_command('AI.MODELEXECUTE', 'm{1}', 'INPUTS', 1, 'a{1}', 'OUTPUTS', 1, 'b{1}') - backends_info = get_info_section(con, 'backends_info') - allocator_access_num_after = backends_info["ai_onnxruntime_memory_access_num"] - env.assertEqual(int(allocator_access_num_after) - int(allocator_access_num_before), 18) - - values = con.execute_command('AI.TENSORGET', 'b{1}', 'VALUES') - argmax = max(range(len(values)), key=lambda i: values[i]) - env.assertEqual(argmax, 1) - - -def test_onnx_use_custom_allocator_with_GPU(env): - if not TEST_ONNX: - env.debugPrint("skipping {} since TEST_ONNX=0".format(sys._getframe().f_code.co_name), force=True) - return - if DEVICE == 'CPU': - env.debugPrint("skipping {} since this test if for GPU only".format(sys._getframe().f_code.co_name), force=True) - return - - con = get_connection(env, '{1}') - model_pb = load_file_content('mul_1.onnx') - - # Expect using the allocator during model set for allocating the model, its input name and output name: - # overall 3 allocations. The model raw size is 130B ,and the names are 2B each. In practice we allocate - # more than 134B as Redis allocator will use additional memory for its internal management and for the - # 64-Byte alignment. When the test runs with valgrind, redis will use malloc for the allocations. - ret = con.execute_command('AI.MODELSTORE', 'm_gpu{1}', 'ONNX', DEVICE, 'BLOB', model_pb) - env.assertEqual(ret, b'OK') - - # but for GPU, expect using the allocator only for allocating input and output names (not the model itself). - ret = con.execute_command('AI.MODELSTORE', 'm_cpu{1}', 'ONNX', 'CPU', 'BLOB', model_pb) - env.assertEqual(ret, b'OK') - backends_info = get_info_section(con, 'backends_info') - - # Expect using at least 130+63+(size of an address) + 4*(2+63+(size of an address)) bytes. - model_allocation_bytes_used = int(backends_info["ai_onnxruntime_memory"]) - env.assertTrue(model_allocation_bytes_used > 472) - env.assertTrue(model_allocation_bytes_used < 705) - env.assertEqual(int(backends_info["ai_onnxruntime_memory_access_num"]), 5) - - # Make sure that allocator is not used for running and freeing the GPU model, except for - # the input and output names allocations (and deallocations). - con.execute_command('AI.TENSORSET', 'a{1}', 'FLOAT', 3, 2, 'VALUES', 1.0, 2.0, 3.0, 4.0, 5.0, 6.0) - con.execute_command('AI.MODELEXECUTE', 'm_gpu{1}', 'INPUTS', 1, 'a{1}', 'OUTPUTS', 1, 'b{1}') - values = con.execute_command('AI.TENSORGET', 'b{1}', 'VALUES') - env.assertEqual(values, [b'1', b'4', b'9', b'16', b'25', b'36']) - # Expect that memory usage didn't change, and for another 4 accesses to the allocator (input and output names - # allocation and free) - backends_info = get_info_section(con, 'backends_info') - env.assertEqual(int(backends_info["ai_onnxruntime_memory"]), model_allocation_bytes_used) - env.assertEqual(int(backends_info["ai_onnxruntime_memory_access_num"]), 9) - - # Expect only 2 more accesses in delete - for deallocating input and output names - con.execute_command('AI.MODELDEL', 'm_gpu{1}') - env.assertFalse(con.execute_command('EXISTS', 'm_gpu{1}')) - backends_info = get_info_section(con, 'backends_info') - env.assertEqual(int(backends_info["ai_onnxruntime_memory_access_num"]), 11) - - class TestOnnxKillSwitch: def __init__(self): From d1c5e804acb4a9b98c3ccc22f5be5af77ed27f0a Mon Sep 17 00:00:00 2001 From: Chayim Kirshen Date: Tue, 5 Oct 2021 10:42:32 +0000 Subject: [PATCH 20/45] xenial onnx 1.9 build using the template --- opt/build/backends.rules | 1 + opt/build/dockerparts/apt.yml | 15 +++++++++++++-- opt/build/onnxruntime/Makefile | 1 + opt/build/onnxruntime/dockerfile.tmpl | 18 +++++++++--------- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/opt/build/backends.rules b/opt/build/backends.rules index 8881c8439..faa655fce 100644 --- a/opt/build/backends.rules +++ b/opt/build/backends.rules @@ -33,6 +33,7 @@ S3_URL=redismodules/${PRODUCT} build: @rm -f ${BACKEND_NAME} *.cid REDIS_ARCH=${ARCH} \ + REDIS_OSNICK=${OSNICK} \ ${READIES}/bin/dockerwrapper \ -d ${CURDIR}/Dockerfile${DOCKER_SUFFIX} \ -t ${DEFAULT_DOCKER_TAG} \ diff --git a/opt/build/dockerparts/apt.yml b/opt/build/dockerparts/apt.yml index 9415c7f2e..a2b09508e 100644 --- a/opt/build/dockerparts/apt.yml +++ b/opt/build/dockerparts/apt.yml @@ -1,7 +1,18 @@ -RUN apt-get -qq update +RUN apt-get update -qq +RUN DEBIAN_NONINTERACTIVE=y1 apt-get install -y software-properties-common + +{% if REDIS_OSNICK == 'xenial' %} +RUN add-apt-repository ppa:deadsnakes/ppa +RUN add-apt-repository ppa:ubuntu-toolchain-r/test +{% endif %} + +RUN apt-get update -qq RUN DEBIAN_NONINTERACTIVE=1 apt-get install -y curl wget tar git patch \ build-essential libcurl4-openssl-dev libssl-dev libatlas-base-dev zlib1g-dev \ - python3 python3-pip python3-dev python3-numpy + python3.6 python3-pip python3-dev python3-numpy + +RUN DEBIAN_NONINTERACTIVE=1 apt-get install -y gcc-9 g++-9 +RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-9 RUN python3 -m pip install --upgrade pip setuptools wheel diff --git a/opt/build/onnxruntime/Makefile b/opt/build/onnxruntime/Makefile index 912bfaa81..da2e75d2f 100755 --- a/opt/build/onnxruntime/Makefile +++ b/opt/build/onnxruntime/Makefile @@ -7,6 +7,7 @@ export REDIS_ONNX_REPO PRODUCT=onnxruntime DOCKER_ORG=redislabs VERSION=${REDIS_ONNX_VERSION} +OSNICK=xenial ROOT=. diff --git a/opt/build/onnxruntime/dockerfile.tmpl b/opt/build/onnxruntime/dockerfile.tmpl index ffbc1b636..e323ebb74 100755 --- a/opt/build/onnxruntime/dockerfile.tmpl +++ b/opt/build/onnxruntime/dockerfile.tmpl @@ -20,20 +20,20 @@ ARG ONNXRUNTIME_VER={{REDIS_ONNX_VERSION}} # build WORKDIR /build {% if REDIS_GPU is defined %} -ARG BUILDTYPE=MinSizeRel -ARG BUILDARGS="--use_cuda --cudnn_home /usr/local/cuda --cuda_home /usr/local/cuda" +{% set BUILDTYPE="MinSizeRel" %} +{% set BUILDARGS="--use_cuda --cudnn_home /usr/local/cuda --cuda_home /usr/local/cuda" %} {% else %} -ARG BUILDTYPE=Release -ARG BUILDARGS +{% set BUILDTYPE="Release" %} +{% set BUILDARGS="" %} {% endif %} -ARG BUILDARGS="--config ${BUILDTYPE} --parallel" -RUN git clone --single-branch --branch v${ONNXRUNTIME_VER} ${ONNXRUNTIME_REPO} onnxruntime +ARG BUILDARGS="--config {{BUILDTYPE}} --parallel" +RUN git clone --single-branch --branch v{{REDIS_ONNX_VERSION}} {{REDIS_ONNX_REPO}} onnxruntime WORKDIR /build/onnxruntime -RUN git fetch --recurse-submodules -RUN ./build.sh --config ${BUILDTYPE} ${BUILDARGS} --update --build --build_shared_lib --parallel +RUN git fetch --recurse-submodules -j4 || git fetch --recurse-submodules +RUN ./build.sh --config {{BUILDTYPE}} {{BUILDARGS}} --update --build --build_shared_lib --parallel # package ADD ./pack.sh /build WORKDIR /build -RUN ./pack.sh {{REDIS_ONNX_VERSION}} {{REDIS_ARCH}} ${BUILDTYPE} linux {% if REDIS_GPU is defined %} gpu {% endif %} +RUN ./pack.sh {{REDIS_ONNX_VERSION}} {{REDIS_ARCH}} {{BUILDTYPE}} linux {% if REDIS_GPU is defined %} gpu {% endif %} From 08e8ef93ee5646d247d1816c440dfaa2d9a61da5 Mon Sep 17 00:00:00 2001 From: "Chayim I. Kirshen" Date: Tue, 5 Oct 2021 14:22:37 +0300 Subject: [PATCH 21/45] fixing python --- opt/build/dockerparts/apt.yml | 7 ++++--- opt/build/onnxruntime/dockerfile.tmpl | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/opt/build/dockerparts/apt.yml b/opt/build/dockerparts/apt.yml index a2b09508e..496e7166a 100644 --- a/opt/build/dockerparts/apt.yml +++ b/opt/build/dockerparts/apt.yml @@ -4,14 +4,15 @@ RUN DEBIAN_NONINTERACTIVE=y1 apt-get install -y software-properties-common {% if REDIS_OSNICK == 'xenial' %} RUN add-apt-repository ppa:deadsnakes/ppa RUN add-apt-repository ppa:ubuntu-toolchain-r/test -{% endif %} +{% endif %} RUN apt-get update -qq RUN DEBIAN_NONINTERACTIVE=1 apt-get install -y curl wget tar git patch \ build-essential libcurl4-openssl-dev libssl-dev libatlas-base-dev zlib1g-dev \ - python3.6 python3-pip python3-dev python3-numpy + python3.6 python3-pip python3-dev python3-numpy \ + gcc-9 g++-9 -RUN DEBIAN_NONINTERACTIVE=1 apt-get install -y gcc-9 g++-9 +RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 60 RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-9 RUN python3 -m pip install --upgrade pip setuptools wheel diff --git a/opt/build/onnxruntime/dockerfile.tmpl b/opt/build/onnxruntime/dockerfile.tmpl index e323ebb74..d962b65f0 100755 --- a/opt/build/onnxruntime/dockerfile.tmpl +++ b/opt/build/onnxruntime/dockerfile.tmpl @@ -30,7 +30,6 @@ WORKDIR /build ARG BUILDARGS="--config {{BUILDTYPE}} --parallel" RUN git clone --single-branch --branch v{{REDIS_ONNX_VERSION}} {{REDIS_ONNX_REPO}} onnxruntime WORKDIR /build/onnxruntime -RUN git fetch --recurse-submodules -j4 || git fetch --recurse-submodules RUN ./build.sh --config {{BUILDTYPE}} {{BUILDARGS}} --update --build --build_shared_lib --parallel # package From 63a318d2779033a4eca0575f76961264952ae528 Mon Sep 17 00:00:00 2001 From: alon Date: Wed, 6 Oct 2021 09:54:32 +0300 Subject: [PATCH 22/45] build onnx + test building with DISABLE_EXTERNAL_INITIALIZERS flag --- get_deps.sh | 2 +- opt/build/onnxruntime/dockerfile.tmpl | 2 +- opt/build/onnxruntime/pack.sh | 7 +++++-- tests/flow/includes.py | 18 +++++++++++------- tests/flow/tests_onnx.py | 19 +++++++++++++++++++ 5 files changed, 37 insertions(+), 11 deletions(-) diff --git a/get_deps.sh b/get_deps.sh index 11e18f8ae..c84e0e67f 100755 --- a/get_deps.sh +++ b/get_deps.sh @@ -289,7 +289,7 @@ fi ################################################################################### ONNXRUNTIME -ORT_VERSION="1.7.1" +ORT_VERSION="1.9.0" if [[ $WITH_ORT != 0 ]]; then [[ $FORCE == 1 ]] && rm -rf $ONNXRUNTIME diff --git a/opt/build/onnxruntime/dockerfile.tmpl b/opt/build/onnxruntime/dockerfile.tmpl index d962b65f0..0148b51e0 100755 --- a/opt/build/onnxruntime/dockerfile.tmpl +++ b/opt/build/onnxruntime/dockerfile.tmpl @@ -24,7 +24,7 @@ WORKDIR /build {% set BUILDARGS="--use_cuda --cudnn_home /usr/local/cuda --cuda_home /usr/local/cuda" %} {% else %} {% set BUILDTYPE="Release" %} -{% set BUILDARGS="" %} +{% set BUILDARGS="--cmake_extra_defines onnxruntime_DISABLE_EXTERNAL_INITIALIZERS=ON" %} {% endif %} ARG BUILDARGS="--config {{BUILDTYPE}} --parallel" diff --git a/opt/build/onnxruntime/pack.sh b/opt/build/onnxruntime/pack.sh index 93f82d1fc..76df79999 100755 --- a/opt/build/onnxruntime/pack.sh +++ b/opt/build/onnxruntime/pack.sh @@ -1,7 +1,7 @@ #!/bin/bash set -e -VER="$1" # 1.8.0 +VER="$1" # 1.9.0 PLATFORM="$2" # x64|jetson BUILDTYPE="$3" # Release BASEOS="$4" # linux (mac future?) @@ -23,7 +23,10 @@ cd onnxruntime/ git rev-parse HEAD > ../pack/GIT_COMMIT_ID cd .. cp onnxruntime/include/onnxruntime/core/session/onnxruntime_c_api.h pack/include/ -cp onnxruntime/include/onnxruntime/core/providers/cuda/cuda_provider_factory.h pack/include/ +cp onnxruntime/include/onnxruntime/core/session/onnxruntime_cxx_api.h pack/include/ +cp onnxruntime/include/onnxruntime/core/session/onnxruntime_cxx_inline.h pack/include/ +cp onnxruntime/include/onnxruntime/core/framework/provider_options.h pack/include/ +cp onnxruntime/include/onnxruntime/core/providers/cpu/cpu_provider_factory.h pack/include/ cd pack/lib/ ln -s libonnxruntime.so.${VER} libonnxruntime.so cd ../.. diff --git a/tests/flow/includes.py b/tests/flow/includes.py index ed06105a4..b61764d81 100755 --- a/tests/flow/includes.py +++ b/tests/flow/includes.py @@ -32,6 +32,10 @@ MAX_TRANSACTIONS=100 +# returns the test name and line number from which a helper function within this file was called +def get_caller_pos(): + return "{}:{}".format(sys._getframe(2).f_code.co_name, sys._getframe(2).f_lineno) + def ensureSlaveSynced(con, env, timeout_ms=0): if env.useSlaves: # When WAIT returns, all the previous write commands @@ -43,7 +47,7 @@ def ensureSlaveSynced(con, env, timeout_ms=0): except Exception as ex: # Error in converting to int env.debugPring(str(ex), force=True) - env.assertFalse(True) + env.assertFalse(True, message=get_caller_pos()) return env.assertEqual(number_replicas, 1) @@ -220,23 +224,23 @@ def load_file_content(file_name): def check_error_message(env, con, error_msg, *command, error_msg_is_substr=False): try: con.execute_command(*command) - env.assertFalse(True) + env.assertFalse(True, message=get_caller_pos()) except Exception as exception: - env.assertEqual(type(exception), redis.exceptions.ResponseError) + env.assertEqual(type(exception), redis.exceptions.ResponseError, message=get_caller_pos()) if error_msg_is_substr: # We only verify that the given error_msg is a substring of the entire error message. - env.assertTrue(str(exception).find(error_msg) > 0) + env.assertTrue(str(exception).find(error_msg) >= 0, message=get_caller_pos()) else: - env.assertEqual(error_msg, str(exception)) + env.assertEqual(error_msg, str(exception), message=get_caller_pos()) def check_error(env, con, *command): try: con.execute_command(*command) - env.assertFalse(True) + env.assertFalse(True, message=get_caller_pos()) except Exception as e: exception = e - env.assertEqual(type(exception), redis.exceptions.ResponseError) + env.assertEqual(type(exception), redis.exceptions.ResponseError, message=get_caller_pos()) # Returns a dict with all the fields of a certain section from INFO MODULES command diff --git a/tests/flow/tests_onnx.py b/tests/flow/tests_onnx.py index 73abd85f4..32e9b444a 100644 --- a/tests/flow/tests_onnx.py +++ b/tests/flow/tests_onnx.py @@ -1,3 +1,4 @@ +import shutil import sys import os import subprocess @@ -428,3 +429,21 @@ def test_multiple_devices(self): backends_info = get_info_section(con, 'backends_info') self.env.assertEqual(backends_info['ai_onnxruntime_maximum_run_sessions_number'], str(len(devices)*self.threads_per_queue)) + + +def test_forbidden_external_initializers(env): + if not TEST_ONNX: + env.debugPrint("skipping {} since TEST_ONNX=0".format(sys._getframe().f_code.co_name), force=True) + return + if DEVICE != 'CPU': + return + con = get_connection(env, '{1}') + + # move the external initializer to the redis' current dir (tests/flow/logs) + external_initializer_model = load_file_content("model_with_external_initializers.onnx") + shutil.copy(ROOT+"/tests/flow/test_data/Pads.bin", ROOT+"/tests/flow/logs") + check_error_message(env, con, "Initializer tensors with external data is not allowed.", + 'AI.MODELSTORE', 'ext_initializers_model{1}', 'ONNX', DEVICE, + 'BLOB', external_initializer_model) + + os.remove(ROOT+"/tests/flow/logs/Pads.bin") From 724319b794cdd28d4d3af601a8b28932b5f65931 Mon Sep 17 00:00:00 2001 From: alon Date: Wed, 6 Oct 2021 11:45:49 +0300 Subject: [PATCH 23/45] Add the model with the external initializer --- tests/flow/test_data/Pads.bin | Bin 0 -> 32 bytes .../model_with_external_initializers.onnx | 3 +++ 2 files changed, 3 insertions(+) create mode 100644 tests/flow/test_data/Pads.bin create mode 100644 tests/flow/test_data/model_with_external_initializers.onnx diff --git a/tests/flow/test_data/Pads.bin b/tests/flow/test_data/Pads.bin new file mode 100644 index 0000000000000000000000000000000000000000..d69e6beeff85daff64de4df5719686b136e278db GIT binary patch literal 32 PcmZQzKn09YE{p~M05|{x literal 0 HcmV?d00001 diff --git a/tests/flow/test_data/model_with_external_initializers.onnx b/tests/flow/test_data/model_with_external_initializers.onnx new file mode 100644 index 000000000..ab5470e22 --- /dev/null +++ b/tests/flow/test_data/model_with_external_initializers.onnx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:52b38a69e506b85e7f73c4a337e2674b5909d037ea94f3d0621c049a96f3e5a1 +size 173 From c9b82a39eb053cbb8bc48387f57e008c8504ec36 Mon Sep 17 00:00:00 2001 From: "Chayim I. Kirshen" Date: Wed, 6 Oct 2021 12:23:12 +0300 Subject: [PATCH 24/45] Variablizing CUDA support Adding support for defining CUDA VERSIONS from outside the docker files, but still using defaults. --- opt/build/onnxruntime/Makefile | 9 ++++++--- opt/build/onnxruntime/dockerfile.tmpl | 20 +++++++++++++++----- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/opt/build/onnxruntime/Makefile b/opt/build/onnxruntime/Makefile index da2e75d2f..1960d406f 100755 --- a/opt/build/onnxruntime/Makefile +++ b/opt/build/onnxruntime/Makefile @@ -1,12 +1,15 @@ REDIS_ONNX_VERSION?=1.9.0 REDIS_ONNX_REPO?=https://github.com/microsoft/onnxruntime -export REDIS_ONNX_VERSION -export REDIS_ONNX_REPO - PRODUCT=onnxruntime DOCKER_ORG=redislabs VERSION=${REDIS_ONNX_VERSION} +REDIS_CUDA_VERSION=11.0-cudnn8 + +export REDIS_ONNX_VERSION +export REDIS_ONNX_REPO +export REDIS_CUDA_VERSION + OSNICK=xenial ROOT=. diff --git a/opt/build/onnxruntime/dockerfile.tmpl b/opt/build/onnxruntime/dockerfile.tmpl index 0148b51e0..a7c7c63c8 100755 --- a/opt/build/onnxruntime/dockerfile.tmpl +++ b/opt/build/onnxruntime/dockerfile.tmpl @@ -1,13 +1,23 @@ -#---------------------------------------------------------------------------------------------- +{% if REDIS_OSNICK == "xenial" %} +{% set cuda_suffix_os = "ubuntu16.04" %} +{% elif REDIS_OSNICK == "bionic" %} +{% set cuda_suffix_os = "ubuntu18.04" %} +{% endif %} + +{% if REDIS_ARCH == 'jetson' %} +FROM nvcr.io/nvidia/deepstream-l4t:5.1-21.02-base +{% endif %} + {% if REDIS_ARCH == 'x64' %} {% if REDIS_GPU is defined %} -FROM nvidia/cuda:11.0-cudnn8-devel-ubuntu16.04 +FROM nvidia/cuda:{{REDIS_CUDA_VERSION}}-devel-{{cuda_suffix_os}} {% else %} +{% if REDIS_OSNICK == "xenial" %} FROM ubuntu:xenial +{% elif REDIS_OSNICK == "bionic" %} +FROM ubuntu:bionic +{% endif %} {% endif %} - -{% elif REDIS_ARCH == 'jetson' %} -FROM nvcr.io/nvidia/deepstream-l4t:5.1-21.02-base {% endif %} ARG ONNXRUNTIME_REPO={{REDIS_ONNX_REPO}} From ef7cc951ad9e2b18161b678dc8eed61b56757187 Mon Sep 17 00:00:00 2001 From: alon Date: Wed, 6 Oct 2021 14:55:26 +0300 Subject: [PATCH 25/45] TF build (WIP) --- opt/build/dockerparts/apt.yml | 18 ++++++++++++++---- opt/build/tensorflow/Makefile | 4 ++-- opt/build/tensorflow/dockerfile.tmpl | 4 ++-- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/opt/build/dockerparts/apt.yml b/opt/build/dockerparts/apt.yml index 3a363e7fb..05ce8461d 100644 --- a/opt/build/dockerparts/apt.yml +++ b/opt/build/dockerparts/apt.yml @@ -1,10 +1,20 @@ -RUN apt-get -qq update +RUN apt-get update -qq +RUN DEBIAN_NONINTERACTIVE=y1 apt-get install -y software-properties-common + +{% if REDIS_OSNICK == 'xenial' %} +RUN add-apt-repository ppa:deadsnakes/ppa +RUN add-apt-repository ppa:ubuntu-toolchain-r/test +{% endif %} + +RUN apt-get update -qq RUN DEBIAN_NONINTERACTIVE=1 apt-get install -y curl wget tar git patch \ build-essential libcurl4-openssl-dev libssl-dev libatlas-base-dev zlib1g-dev \ - python3.6 python3-pip python3-dev python3-numpy + python3 python3-pip python3-dev python3-numpy \ + gcc-9 g++-9 + +RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3 60 +RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-9 -RUN rm /usr/bin/python3 -RUN ln -s /usr/bin/python3.6 /usr/bin/python3 RUN python3 -m pip install --upgrade pip setuptools wheel ENV LANG=en_US.UTF-8 diff --git a/opt/build/tensorflow/Makefile b/opt/build/tensorflow/Makefile index 7887ec8ac..a94161cb7 100755 --- a/opt/build/tensorflow/Makefile +++ b/opt/build/tensorflow/Makefile @@ -1,5 +1,5 @@ -REDIS_BAZEL_VERSION?=3.7.2 -REDIS_TF_VERSION?=2.5.0 +REDIS_BAZEL_VERSION?=4.2.1 +REDIS_TF_VERSION?=2.6.0 export REDIS_TF_VERSION export REDIS_BAZEL_VERSION diff --git a/opt/build/tensorflow/dockerfile.tmpl b/opt/build/tensorflow/dockerfile.tmpl index 3cb5f0bf8..3dbb9c971 100644 --- a/opt/build/tensorflow/dockerfile.tmpl +++ b/opt/build/tensorflow/dockerfile.tmpl @@ -1,8 +1,8 @@ {% if REDIS_ARCH == 'x64' %} {% if REDIS_GPU is defined %} -FROM nvidia/cuda:11.0-cudnn8-devel-ubuntu18.04 +FROM nvidia/cuda:11.0-cudnn8-devel-ubuntu16.04 {% else %} -FROM ubuntu:bionic +FROM ubuntu:xenial {% endif %} {% elif REDIS_ARCH == 'jetson' %} From 1aa4836c9c00823b083b16f20aad9861fdf69e4e Mon Sep 17 00:00:00 2001 From: alon Date: Wed, 6 Oct 2021 16:00:27 +0300 Subject: [PATCH 26/45] use new key for deps cache --- .circleci/config.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 77850db05..295ae6b09 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -101,7 +101,7 @@ commands: - checkout-all - restore_cache: keys: - - v1-dependencies-{{ checksum "get_deps.sh" }}-cpu + - v1.2-dependencies-{{ checksum "get_deps.sh" }}-cpu # If no exact match is found will get dependencies from source - setup-build-system - run: @@ -112,7 +112,7 @@ commands: - save_cache: paths: - deps - key: v1-dependencies-{{ checksum "get_deps.sh" }}-cpu + key: v1.2-dependencies-{{ checksum "get_deps.sh" }}-cpu - run: name: Build command: make -C opt all SHOW=1 @@ -178,7 +178,7 @@ commands: - checkout-all - restore_cache: keys: - - v1-dependencies-{{ checksum "get_deps.sh" }}-gpu + - v1.2-dependencies-{{ checksum "get_deps.sh" }}-gpu - relocate-docker-storage - run: name: Build @@ -189,7 +189,7 @@ commands: - save_cache: paths: - deps - key: v1-dependencies-{{ checksum "get_deps.sh" }}-gpu + key: v1.2-dependencies-{{ checksum "get_deps.sh" }}-gpu - run: name: Test command: | @@ -239,7 +239,7 @@ jobs: - checkout-all - restore_cache: keys: - - v1-dependencies-{{ checksum "get_deps.sh" }}-<>-<> + - v1.2-dependencies-{{ checksum "get_deps.sh" }}-<>-<> - setup-automation # since we run in parallel, we need to generate docker files with different suffixes hence the DOCKER_SUFFIX @@ -260,7 +260,7 @@ jobs: - save_cache: paths: - deps - key: v1-dependencies-{{ checksum "get_deps.sh" }}-<>-<> + key: v1.2-dependencies-{{ checksum "get_deps.sh" }}-<>-<> - persist_to_workspace: root: bin/ paths: @@ -275,7 +275,7 @@ jobs: - checkout-all - restore_cache: keys: - - v1-dependencies-{{ checksum "get_deps.sh" }}-cpu + - v1.2-dependencies-{{ checksum "get_deps.sh" }}-cpu # If no exact match is found will get dependencies from source - setup-build-system - run: @@ -309,7 +309,7 @@ jobs: - checkout-all - restore_cache: keys: - - v1-dependencies-{{ checksum "get_deps.sh" }}-cpu + - v1.2-dependencies-{{ checksum "get_deps.sh" }}-cpu # If no exact match is found will get dependencies from source - setup-build-system - run: From 11f00d30d3e272880d00b8ecd871d08a54332dab Mon Sep 17 00:00:00 2001 From: "Chayim I. Kirshen" Date: Wed, 6 Oct 2021 17:37:24 +0300 Subject: [PATCH 27/45] base shared for the backends onnx fix to use the local python tensorflow up to the compilation point --- opt/build/backends.rules | 18 +++++++---------- opt/build/dockerparts/apt.yml | 4 ++-- opt/build/dockerparts/base_image.tmpl | 22 ++++++++++++++++++++ opt/build/onnxruntime/.gitignore | 2 +- opt/build/onnxruntime/Makefile | 12 +++++++---- opt/build/onnxruntime/dockerfile.tmpl | 29 +++++++++------------------ opt/build/tensorflow/.gitignore | 2 ++ opt/build/tensorflow/Makefile | 6 +++++- opt/build/tensorflow/dockerfile.tmpl | 11 +--------- 9 files changed, 57 insertions(+), 49 deletions(-) create mode 100644 opt/build/dockerparts/base_image.tmpl create mode 100644 opt/build/tensorflow/.gitignore diff --git a/opt/build/backends.rules b/opt/build/backends.rules index 8ae10213c..faa655fce 100644 --- a/opt/build/backends.rules +++ b/opt/build/backends.rules @@ -1,14 +1,9 @@ # default is x64 -ARCH?=$(shell ${READIES}/bin/platform --arch) -OS?=$(shell ${READIES}/bin/platform --os) -ifeq ($(OS),macos) -OS?=darwin -endif -REDIS_OS=${OS} -export REDIS_OS +ARCH=$(shell ${READIES}/bin/platform --arch) +OS=$(shell ${READIES}/bin/platform --os) +REDIS_CMAKE_ARCH=x86_64 # jetson -REDIS_CMAKE_ARCH=x86_64 ifeq ($(shell test -e /usr/share/doc/nvidia-l4t-jetson-io && echo -n yes),yes) ARCH=jetson REDIS_CMAKE_ARCH=aarch64 @@ -17,7 +12,7 @@ endif export REDIS_CMAKE_ARCH # override if necessary in top-level make files -DEFAULT_DOCKER_TAG?=${DOCKER_ORG}/${PRODUCT}:build +DEFAULT_DOCKER_TAG=${DOCKER_ORG}/${PRODUCT}:build CIDFILE=${PRODUCT}.${ARCH}.cid ifeq ($(GPU),1) @@ -28,9 +23,9 @@ export REDIS_GPU endif ifeq ($(VARIANT),) -BACKEND_NAME?=${PRODUCT}-${OS}-${ARCH}-${VERSION}.tgz +BACKEND_NAME=${PRODUCT}-${OS}-${ARCH}-${VERSION}.tgz else -BACKEND_NAME?=${PRODUCT}-${OS}-${ARCH}-${VARIANT}-${VERSION}.tgz +BACKEND_NAME=${PRODUCT}-${OS}-${ARCH}-${VARIANT}-${VERSION}.tgz endif S3_URL=redismodules/${PRODUCT} @@ -38,6 +33,7 @@ S3_URL=redismodules/${PRODUCT} build: @rm -f ${BACKEND_NAME} *.cid REDIS_ARCH=${ARCH} \ + REDIS_OSNICK=${OSNICK} \ ${READIES}/bin/dockerwrapper \ -d ${CURDIR}/Dockerfile${DOCKER_SUFFIX} \ -t ${DEFAULT_DOCKER_TAG} \ diff --git a/opt/build/dockerparts/apt.yml b/opt/build/dockerparts/apt.yml index 05ce8461d..cfe05e248 100644 --- a/opt/build/dockerparts/apt.yml +++ b/opt/build/dockerparts/apt.yml @@ -9,10 +9,10 @@ RUN add-apt-repository ppa:ubuntu-toolchain-r/test RUN apt-get update -qq RUN DEBIAN_NONINTERACTIVE=1 apt-get install -y curl wget tar git patch \ build-essential libcurl4-openssl-dev libssl-dev libatlas-base-dev zlib1g-dev \ - python3 python3-pip python3-dev python3-numpy \ + python3.6 python3-pip python3.6-dev python3-numpy \ gcc-9 g++-9 -RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3 60 +RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 60 RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-9 RUN python3 -m pip install --upgrade pip setuptools wheel diff --git a/opt/build/dockerparts/base_image.tmpl b/opt/build/dockerparts/base_image.tmpl new file mode 100644 index 000000000..0af08efdc --- /dev/null +++ b/opt/build/dockerparts/base_image.tmpl @@ -0,0 +1,22 @@ +{% if REDIS_OSNICK == "xenial" %} +{% set cuda_suffix_os = "ubuntu16.04" %} +{% elif REDIS_OSNICK == "bionic" %} +{% set cuda_suffix_os = "ubuntu18.04" %} +{% endif %} + +{% if REDIS_ARCH == 'jetson' %} +FROM nvcr.io/nvidia/deepstream-l4t:5.1-21.02-base +{% endif %} + +{% if REDIS_ARCH == 'x64' %} +{% if REDIS_GPU is defined %} +FROM nvidia/cuda:{{REDIS_CUDA_VERSION}}-devel-{{cuda_suffix_os}} +{% else %} +{% if REDIS_OSNICK == "xenial" %} +FROM ubuntu:xenial +{% elif REDIS_OSNICK == "bionic" %} +FROM ubuntu:bionic +{% endif %} +{% endif %} +{% endif %} + diff --git a/opt/build/onnxruntime/.gitignore b/opt/build/onnxruntime/.gitignore index ce84fec50..f4199305e 100644 --- a/opt/build/onnxruntime/.gitignore +++ b/opt/build/onnxruntime/.gitignore @@ -1,2 +1,2 @@ Dockerfile -onnxruntime.x64.cid +*.cid diff --git a/opt/build/onnxruntime/Makefile b/opt/build/onnxruntime/Makefile index aa8de57e0..1960d406f 100755 --- a/opt/build/onnxruntime/Makefile +++ b/opt/build/onnxruntime/Makefile @@ -1,12 +1,16 @@ -REDIS_ONNX_VERSION?=1.8.0 +REDIS_ONNX_VERSION?=1.9.0 REDIS_ONNX_REPO?=https://github.com/microsoft/onnxruntime -export REDIS_ONNX_VERSION -export REDIS_ONNX_REPO - PRODUCT=onnxruntime DOCKER_ORG=redislabs VERSION=${REDIS_ONNX_VERSION} +REDIS_CUDA_VERSION=11.0-cudnn8 + +export REDIS_ONNX_VERSION +export REDIS_ONNX_REPO +export REDIS_CUDA_VERSION + +OSNICK=xenial ROOT=. diff --git a/opt/build/onnxruntime/dockerfile.tmpl b/opt/build/onnxruntime/dockerfile.tmpl index 2c19bb2f4..f0ee16d0f 100755 --- a/opt/build/onnxruntime/dockerfile.tmpl +++ b/opt/build/onnxruntime/dockerfile.tmpl @@ -1,14 +1,4 @@ -#---------------------------------------------------------------------------------------------- -{% if REDIS_ARCH == 'x64' %} -{% if REDIS_GPU is defined %} -FROM nvidia/cuda:11.0-cudnn8-devel-ubuntu18.04 -{% else %} -FROM ubuntu:bionic -{% endif %} - -{% elif REDIS_ARCH == 'jetson' %} -FROM nvcr.io/nvidia/deepstream-l4t:5.1-21.02-base -{% endif %} +{% include 'base_image.tmpl' %} ARG ONNXRUNTIME_REPO={{REDIS_ONNX_REPO}} ARG ONNXRUNTIME_VER={{REDIS_ONNX_VERSION}} @@ -20,20 +10,19 @@ ARG ONNXRUNTIME_VER={{REDIS_ONNX_VERSION}} # build WORKDIR /build {% if REDIS_GPU is defined %} -ARG BUILDTYPE=MinSizeRel -ARG BUILDARGS="--use_cuda --cudnn_home /usr/local/cuda --cuda_home /usr/local/cuda" +{% set BUILDTYPE="MinSizeRel" %} +{% set BUILDARGS="--use_cuda --cudnn_home /usr/local/cuda --cuda_home /usr/local/cuda" %} {% else %} -ARG BUILDTYPE=Release -ARG BUILDARGS +{% set BUILDTYPE="Release" %} +{% set BUILDARGS="--cmake_extra_defines onnxruntime_DISABLE_EXTERNAL_INITIALIZERS=ON" %} {% endif %} -ARG BUILDARGS="--config ${BUILDTYPE} --parallel" -RUN git clone --single-branch --branch v${ONNXRUNTIME_VER} ${ONNXRUNTIME_REPO} onnxruntime +ARG BUILDARGS="--config {{BUILDTYPE}} --parallel" +RUN git clone --single-branch --branch v{{REDIS_ONNX_VERSION}} {{REDIS_ONNX_REPO}} onnxruntime WORKDIR /build/onnxruntime -RUN git fetch --recurse-submodules -j4 -RUN ./build.sh --config ${BUILDTYPE} ${BUILDARGS} --update --build --build_shared_lib --parallel +RUN ./build.sh --config {{BUILDTYPE}} {{BUILDARGS}} --update --build --build_shared_lib --parallel # package ADD ./pack.sh /build WORKDIR /build -RUN ./pack.sh {{REDIS_ONNX_VERSION}} {{REDIS_ARCH}} ${BUILDTYPE} linux {% if REDIS_GPU is defined %} gpu {% endif %} +RUN ./pack.sh {{REDIS_ONNX_VERSION}} {{REDIS_ARCH}} {{BUILDTYPE}} linux {% if REDIS_GPU is defined %} gpu {% endif %} diff --git a/opt/build/tensorflow/.gitignore b/opt/build/tensorflow/.gitignore new file mode 100644 index 000000000..f4199305e --- /dev/null +++ b/opt/build/tensorflow/.gitignore @@ -0,0 +1,2 @@ +Dockerfile +*.cid diff --git a/opt/build/tensorflow/Makefile b/opt/build/tensorflow/Makefile index a94161cb7..5b9bf6263 100755 --- a/opt/build/tensorflow/Makefile +++ b/opt/build/tensorflow/Makefile @@ -1,4 +1,4 @@ -REDIS_BAZEL_VERSION?=4.2.1 +REDIS_BAZEL_VERSION?=3.5 REDIS_TF_VERSION?=2.6.0 export REDIS_TF_VERSION @@ -7,6 +7,10 @@ export REDIS_BAZEL_VERSION PRODUCT=tensorflow DOCKER_ORG=redislabs VERSION=${REDIS_TF_VERSION} +REDIS_CUDA_VERSION=11.0-cudnn8 + +export REDIS_ONNX_VERSION +OSNICK=xenial ROOT=. UNAME_MACHINE=$(shell uname -m) diff --git a/opt/build/tensorflow/dockerfile.tmpl b/opt/build/tensorflow/dockerfile.tmpl index 3dbb9c971..eab2f9975 100644 --- a/opt/build/tensorflow/dockerfile.tmpl +++ b/opt/build/tensorflow/dockerfile.tmpl @@ -1,13 +1,4 @@ -{% if REDIS_ARCH == 'x64' %} -{% if REDIS_GPU is defined %} -FROM nvidia/cuda:11.0-cudnn8-devel-ubuntu16.04 -{% else %} -FROM ubuntu:xenial -{% endif %} - -{% elif REDIS_ARCH == 'jetson' %} -FROM nvcr.io/nvidia/deepstream-l4t:5.1-21.02-base -{% endif %} +{% include 'base_image.tmpl' %} {% include 'apt.yml' %} From 5054d4ec1166682a0f52876b65d220da855e8506 Mon Sep 17 00:00:00 2001 From: alon Date: Thu, 7 Oct 2021 10:30:27 +0300 Subject: [PATCH 28/45] WIP --- get_deps.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/get_deps.sh b/get_deps.sh index 1a474639f..af75ffbf7 100755 --- a/get_deps.sh +++ b/get_deps.sh @@ -2,9 +2,9 @@ ###### SET VERSIONS ###### -ORT_VERSION="1.7.1" +ORT_VERSION="1.9.0" DLPACK_VERSION="v0.5_RAI" -TF_VERSION="2.5.0" +TF_VERSION="2.6.0" TFLITE_VERSION="2.0.0" PT_VERSION="1.9.0" From 44e13811bc4a494c0dd75b713b4fe73d4a7d6694 Mon Sep 17 00:00:00 2001 From: alon Date: Thu, 7 Oct 2021 12:26:10 +0300 Subject: [PATCH 29/45] WIP --- src/backends/onnxruntime.c | 5 +- tests/flow/tests_onnx.py | 109 ------------------------------------- 2 files changed, 1 insertion(+), 113 deletions(-) diff --git a/src/backends/onnxruntime.c b/src/backends/onnxruntime.c index f6145ebef..ed3a41efc 100644 --- a/src/backends/onnxruntime.c +++ b/src/backends/onnxruntime.c @@ -1,5 +1,4 @@ #define REDISMODULE_MAIN -#include #include "backends/util.h" #include #include @@ -391,9 +390,7 @@ RAI_Model *RAI_ModelCreateORT(RAI_Backend backend, const char *devicestr, RAI_Mo // models inputs and outputs names (for both models that run on CPU and GPU) if (env == NULL) { ONNX_VALIDATE_STATUS(ort->CreateEnv(ORT_LOGGING_LEVEL_WARNING, "test", &env)) - ONNX_VALIDATE_STATUS(ort->CreateCustomDeviceAllocator( - ORT_API_VERSION, AllocatorAlloc, AllocatorFree, AllocatorInfo, &global_allocator)) - ONNX_VALIDATE_STATUS(ort->RegisterCustomDeviceAllocator(env, global_allocator)) + ONNX_VALIDATE_STATUS(ort->GetAllocatorWithDefaultOptions(&global_allocator)); } ONNX_VALIDATE_STATUS(ort->CreateSessionOptions(&session_options)) diff --git a/tests/flow/tests_onnx.py b/tests/flow/tests_onnx.py index 1fd83d27b..73abd85f4 100644 --- a/tests/flow/tests_onnx.py +++ b/tests/flow/tests_onnx.py @@ -363,115 +363,6 @@ def test_parallelism(): env.assertEqual(load_time_config["ai_intra_op_parallelism"], "2") -def test_onnx_use_custom_allocator(env): - if not TEST_ONNX: - env.debugPrint("skipping {} since TEST_ONNX=0".format(sys._getframe().f_code.co_name), force=True) - return - - con = get_connection(env, '{1}') - model_pb = load_file_content('mul_1.onnx') - - # Expect using the allocator during model set for allocating the model, its input name and output name: - # overall 3 allocations. The model raw size is 130B ,and the names are 2B each. In practice we allocate - # more than 134B as Redis allocator will use additional memory for its internal management and for the - # 64-Byte alignment. When the test runs with valgrind, redis will use malloc for the allocations - # (hence will not use additional memory). - ret = con.execute_command('AI.MODELSTORE', 'm{1}', 'ONNX', 'CPU', 'BLOB', model_pb) - env.assertEqual(ret, b'OK') - backends_info = get_info_section(con, 'backends_info') - - # Expect using at least 130+63+(size of an address) + 2*(2+63+(size of an address)) bytes. - model_allocation_bytes_used = int(backends_info["ai_onnxruntime_memory"]) - env.assertTrue(model_allocation_bytes_used > 334) - env.assertEqual(int(backends_info["ai_onnxruntime_memory_access_num"]), 3) - con.execute_command('AI.TENSORSET', 'a_mul{1}', 'FLOAT', 3, 2, 'VALUES', 1.0, 2.0, 3.0, 4.0, 5.0, 6.0) - - # Running the model should access the allocator 6 times: allocating+freeing input+output names, - # and allocating+freeing the output as OrtValue. - con.execute_command('AI.MODELEXECUTE', 'm{1}', 'INPUTS', 1, 'a_mul{1}', 'OUTPUTS', 1, 'b{1}') - values = con.execute_command('AI.TENSORGET', 'b{1}', 'VALUES') - env.assertEqual(values, [b'1', b'4', b'9', b'16', b'25', b'36']) - backends_info = get_info_section(con, 'backends_info') - env.assertEqual(int(backends_info["ai_onnxruntime_memory_access_num"]), 9) - env.assertEqual(int(backends_info["ai_onnxruntime_memory"]), model_allocation_bytes_used) - - # Expect using the allocator free function 3 times: when releasing the model, input name and output name. - con.execute_command('AI.MODELDEL', 'm{1}') - env.assertFalse(con.execute_command('EXISTS', 'm{1}')) - backends_info = get_info_section(con, 'backends_info') - env.assertEqual(int(backends_info["ai_onnxruntime_memory"]), 0) - env.assertEqual(int(backends_info["ai_onnxruntime_memory_access_num"]), 12) - - # test the use of Redis allocator in model run op. - model_pb = load_file_content('mnist.onnx') - sample_raw = load_file_content('one.raw') - - ret = con.execute_command('AI.MODELSTORE', 'm{1}', 'ONNX', 'CPU', 'BLOB', model_pb) - env.assertEqual(ret, b'OK') - con.execute_command('AI.TENSORSET', 'a{1}', 'FLOAT', 1, 1, 28, 28, 'BLOB', sample_raw) - - # Expect 18 allocator's access from onnx during the run (in addition to the allocations that were made while - # creating the model). - backends_info = get_info_section(con, 'backends_info') - allocator_access_num_before = backends_info["ai_onnxruntime_memory_access_num"] - con.execute_command('AI.MODELEXECUTE', 'm{1}', 'INPUTS', 1, 'a{1}', 'OUTPUTS', 1, 'b{1}') - backends_info = get_info_section(con, 'backends_info') - allocator_access_num_after = backends_info["ai_onnxruntime_memory_access_num"] - env.assertEqual(int(allocator_access_num_after) - int(allocator_access_num_before), 18) - - values = con.execute_command('AI.TENSORGET', 'b{1}', 'VALUES') - argmax = max(range(len(values)), key=lambda i: values[i]) - env.assertEqual(argmax, 1) - - -def test_onnx_use_custom_allocator_with_GPU(env): - if not TEST_ONNX: - env.debugPrint("skipping {} since TEST_ONNX=0".format(sys._getframe().f_code.co_name), force=True) - return - if DEVICE == 'CPU': - env.debugPrint("skipping {} since this test if for GPU only".format(sys._getframe().f_code.co_name), force=True) - return - - con = get_connection(env, '{1}') - model_pb = load_file_content('mul_1.onnx') - - # Expect using the allocator during model set for allocating the model, its input name and output name: - # overall 3 allocations. The model raw size is 130B ,and the names are 2B each. In practice we allocate - # more than 134B as Redis allocator will use additional memory for its internal management and for the - # 64-Byte alignment. When the test runs with valgrind, redis will use malloc for the allocations. - ret = con.execute_command('AI.MODELSTORE', 'm_gpu{1}', 'ONNX', DEVICE, 'BLOB', model_pb) - env.assertEqual(ret, b'OK') - - # but for GPU, expect using the allocator only for allocating input and output names (not the model itself). - ret = con.execute_command('AI.MODELSTORE', 'm_cpu{1}', 'ONNX', 'CPU', 'BLOB', model_pb) - env.assertEqual(ret, b'OK') - backends_info = get_info_section(con, 'backends_info') - - # Expect using at least 130+63+(size of an address) + 4*(2+63+(size of an address)) bytes. - model_allocation_bytes_used = int(backends_info["ai_onnxruntime_memory"]) - env.assertTrue(model_allocation_bytes_used > 472) - env.assertTrue(model_allocation_bytes_used < 705) - env.assertEqual(int(backends_info["ai_onnxruntime_memory_access_num"]), 5) - - # Make sure that allocator is not used for running and freeing the GPU model, except for - # the input and output names allocations (and deallocations). - con.execute_command('AI.TENSORSET', 'a{1}', 'FLOAT', 3, 2, 'VALUES', 1.0, 2.0, 3.0, 4.0, 5.0, 6.0) - con.execute_command('AI.MODELEXECUTE', 'm_gpu{1}', 'INPUTS', 1, 'a{1}', 'OUTPUTS', 1, 'b{1}') - values = con.execute_command('AI.TENSORGET', 'b{1}', 'VALUES') - env.assertEqual(values, [b'1', b'4', b'9', b'16', b'25', b'36']) - # Expect that memory usage didn't change, and for another 4 accesses to the allocator (input and output names - # allocation and free) - backends_info = get_info_section(con, 'backends_info') - env.assertEqual(int(backends_info["ai_onnxruntime_memory"]), model_allocation_bytes_used) - env.assertEqual(int(backends_info["ai_onnxruntime_memory_access_num"]), 9) - - # Expect only 2 more accesses in delete - for deallocating input and output names - con.execute_command('AI.MODELDEL', 'm_gpu{1}') - env.assertFalse(con.execute_command('EXISTS', 'm_gpu{1}')) - backends_info = get_info_section(con, 'backends_info') - env.assertEqual(int(backends_info["ai_onnxruntime_memory_access_num"]), 11) - - class TestOnnxKillSwitch: def __init__(self): From 297709845628f766c932717c4913275779a5518f Mon Sep 17 00:00:00 2001 From: "Chayim I. Kirshen" Date: Thu, 7 Oct 2021 15:06:47 +0300 Subject: [PATCH 30/45] gcc due to glibc versioning --- .circleci/config.yml | 22 +++++++++++----------- opt/build/dockerparts/apt.yml | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 295ae6b09..367c52ad7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -215,7 +215,7 @@ jobs: build-and-test: docker: - - image: redisfab/rmbuilder:6.2.5-x64-buster + - image: redisfab/rmbuilder:6.2.5-x64-bionic steps: - build-steps: platform: debian @@ -229,7 +229,7 @@ jobs: target: # CPU|GPU type: string docker: - - image: redisfab/rmbuilder:6.2.5-x64-buster + - image: redisfab/rmbuilder:6.2.5-x64-bionic steps: - abort_for_docs - abort_for_noci @@ -268,7 +268,7 @@ jobs: coverage: docker: - - image: redisfab/rmbuilder:6.2.5-x64-buster + - image: redisfab/rmbuilder:6.2.5-x64-bionic steps: - abort_for_docs - abort_for_noci @@ -302,7 +302,7 @@ jobs: type: string default: "CLUSTER=0" docker: - - image: redisfab/rmbuilder:6.2.5-x64-buster + - image: redisfab/rmbuilder:6.2.5-x64-bionic steps: - abort_for_docs - abort_for_noci @@ -331,14 +331,14 @@ jobs: valgrind-general-for-forked-prs: docker: - - image: redisfab/rmbuilder:6.2.5-x64-buster + - image: redisfab/rmbuilder:6.2.5-x64-bionic steps: - only_run_if_forked_pull_request - valgrind-general-steps valgrind-general: docker: - - image: redisfab/rmbuilder:6.2.5-x64-buster + - image: redisfab/rmbuilder:6.2.5-x64-bionic steps: - valgrind-general-steps @@ -411,7 +411,7 @@ jobs: location: type: string docker: - - image: redisfab/rmbuilder:6.2.5-x64-buster + - image: redisfab/rmbuilder:6.2.5-x64-bionic steps: - abort_for_docs - abort_for_noci @@ -429,7 +429,7 @@ jobs: deploy-snapshot: docker: - - image: redisfab/rmbuilder:6.2.5-x64-buster + - image: redisfab/rmbuilder:6.2.5-x64-bionic steps: - abort_for_docs - abort_for_noci @@ -446,7 +446,7 @@ jobs: deploy-release: docker: - - image: redisfab/rmbuilder:6.2.5-x64-buster + - image: redisfab/rmbuilder:6.2.5-x64-bionic steps: - abort_for_docs - abort_for_noci @@ -464,7 +464,7 @@ jobs: release-automation: docker: - - image: redisfab/rmbuilder:6.2.5-x64-buster + - image: redisfab/rmbuilder:6.2.5-x64-bionic steps: - checkout - setup-automation @@ -478,7 +478,7 @@ jobs: #nightly-automation: # docker: - # - image: redisfab/rmbuilder:6.2.5-x64-buster + # - image: redisfab/rmbuilder:6.2.5-x64-bionic # steps: # - checkout # - setup-automation diff --git a/opt/build/dockerparts/apt.yml b/opt/build/dockerparts/apt.yml index 496e7166a..ee7233d94 100644 --- a/opt/build/dockerparts/apt.yml +++ b/opt/build/dockerparts/apt.yml @@ -10,10 +10,10 @@ RUN apt-get update -qq RUN DEBIAN_NONINTERACTIVE=1 apt-get install -y curl wget tar git patch \ build-essential libcurl4-openssl-dev libssl-dev libatlas-base-dev zlib1g-dev \ python3.6 python3-pip python3-dev python3-numpy \ - gcc-9 g++-9 + gcc-7 g++-7 RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 60 -RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-9 +RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 --slave /usr/bin/g++ g++ /usr/bin/g++-7 RUN python3 -m pip install --upgrade pip setuptools wheel From 728b6b9287f4ac0b4f0b29d519633e7c0151dd87 Mon Sep 17 00:00:00 2001 From: "Chayim I. Kirshen" Date: Thu, 7 Oct 2021 15:47:51 +0300 Subject: [PATCH 31/45] s/bionic/buster/ is back --- .circleci/config.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 367c52ad7..295ae6b09 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -215,7 +215,7 @@ jobs: build-and-test: docker: - - image: redisfab/rmbuilder:6.2.5-x64-bionic + - image: redisfab/rmbuilder:6.2.5-x64-buster steps: - build-steps: platform: debian @@ -229,7 +229,7 @@ jobs: target: # CPU|GPU type: string docker: - - image: redisfab/rmbuilder:6.2.5-x64-bionic + - image: redisfab/rmbuilder:6.2.5-x64-buster steps: - abort_for_docs - abort_for_noci @@ -268,7 +268,7 @@ jobs: coverage: docker: - - image: redisfab/rmbuilder:6.2.5-x64-bionic + - image: redisfab/rmbuilder:6.2.5-x64-buster steps: - abort_for_docs - abort_for_noci @@ -302,7 +302,7 @@ jobs: type: string default: "CLUSTER=0" docker: - - image: redisfab/rmbuilder:6.2.5-x64-bionic + - image: redisfab/rmbuilder:6.2.5-x64-buster steps: - abort_for_docs - abort_for_noci @@ -331,14 +331,14 @@ jobs: valgrind-general-for-forked-prs: docker: - - image: redisfab/rmbuilder:6.2.5-x64-bionic + - image: redisfab/rmbuilder:6.2.5-x64-buster steps: - only_run_if_forked_pull_request - valgrind-general-steps valgrind-general: docker: - - image: redisfab/rmbuilder:6.2.5-x64-bionic + - image: redisfab/rmbuilder:6.2.5-x64-buster steps: - valgrind-general-steps @@ -411,7 +411,7 @@ jobs: location: type: string docker: - - image: redisfab/rmbuilder:6.2.5-x64-bionic + - image: redisfab/rmbuilder:6.2.5-x64-buster steps: - abort_for_docs - abort_for_noci @@ -429,7 +429,7 @@ jobs: deploy-snapshot: docker: - - image: redisfab/rmbuilder:6.2.5-x64-bionic + - image: redisfab/rmbuilder:6.2.5-x64-buster steps: - abort_for_docs - abort_for_noci @@ -446,7 +446,7 @@ jobs: deploy-release: docker: - - image: redisfab/rmbuilder:6.2.5-x64-bionic + - image: redisfab/rmbuilder:6.2.5-x64-buster steps: - abort_for_docs - abort_for_noci @@ -464,7 +464,7 @@ jobs: release-automation: docker: - - image: redisfab/rmbuilder:6.2.5-x64-bionic + - image: redisfab/rmbuilder:6.2.5-x64-buster steps: - checkout - setup-automation @@ -478,7 +478,7 @@ jobs: #nightly-automation: # docker: - # - image: redisfab/rmbuilder:6.2.5-x64-bionic + # - image: redisfab/rmbuilder:6.2.5-x64-buster # steps: # - checkout # - setup-automation From ba3e07076d4b748d4aa03c86612b0226adb3d064 Mon Sep 17 00:00:00 2001 From: alon Date: Thu, 7 Oct 2021 16:00:37 +0300 Subject: [PATCH 32/45] update error message that has changed in the new TF GPU version on a dag test --- tests/flow/tests_dag_errors.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/flow/tests_dag_errors.py b/tests/flow/tests_dag_errors.py index 77e16f99d..e388fb076 100644 --- a/tests/flow/tests_dag_errors.py +++ b/tests/flow/tests_dag_errors.py @@ -280,4 +280,9 @@ def test_dag_error_before_tensorget_op(env): env.assertEqual(ret[1], b'OK') env.assertEqual(ret[3], b'NA') env.assertEqual(type(ret[2]), redis.exceptions.ResponseError) - env.assertTrue('Incompatible shapes: [2] vs. [2,2,3] \t [[{{node mul}}]]' in str(ret[2])) + expected_error_msg = 'Incompatible shapes: [2] vs. [2,2,3] \t [[{{node mul}}]]' + if DEVICE != 'CPU': + expected_error_msg = '2 root error(s) found. (0) Invalid argument: required broadcastable shapes' \ + ' [[{{node mul}}]] (1) Invalid argument: required broadcastable shapes' \ + ' [[{{node mul}}]] [[mul/_5]] 0 successful operations. 0 derived errors ignored.' + env.assertEqual(expected_error_msg, str(ret[2])) From 2b1f0bdf2014e6020be9e7710c367dee28d64ff4 Mon Sep 17 00:00:00 2001 From: alon Date: Thu, 7 Oct 2021 16:24:48 +0300 Subject: [PATCH 33/45] update deps cache key to v1.2.5 --- .circleci/config.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 367c52ad7..d05e26235 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -101,7 +101,7 @@ commands: - checkout-all - restore_cache: keys: - - v1.2-dependencies-{{ checksum "get_deps.sh" }}-cpu + - v1.2.5-dependencies-{{ checksum "get_deps.sh" }}-cpu # If no exact match is found will get dependencies from source - setup-build-system - run: @@ -112,7 +112,7 @@ commands: - save_cache: paths: - deps - key: v1.2-dependencies-{{ checksum "get_deps.sh" }}-cpu + key: v1.2.5-dependencies-{{ checksum "get_deps.sh" }}-cpu - run: name: Build command: make -C opt all SHOW=1 @@ -178,7 +178,7 @@ commands: - checkout-all - restore_cache: keys: - - v1.2-dependencies-{{ checksum "get_deps.sh" }}-gpu + - v1.2.5-dependencies-{{ checksum "get_deps.sh" }}-gpu - relocate-docker-storage - run: name: Build @@ -189,7 +189,7 @@ commands: - save_cache: paths: - deps - key: v1.2-dependencies-{{ checksum "get_deps.sh" }}-gpu + key: v1.2.5-dependencies-{{ checksum "get_deps.sh" }}-gpu - run: name: Test command: | @@ -239,7 +239,7 @@ jobs: - checkout-all - restore_cache: keys: - - v1.2-dependencies-{{ checksum "get_deps.sh" }}-<>-<> + - v1.2.5-dependencies-{{ checksum "get_deps.sh" }}-<>-<> - setup-automation # since we run in parallel, we need to generate docker files with different suffixes hence the DOCKER_SUFFIX @@ -260,7 +260,7 @@ jobs: - save_cache: paths: - deps - key: v1.2-dependencies-{{ checksum "get_deps.sh" }}-<>-<> + key: v1.2.5-dependencies-{{ checksum "get_deps.sh" }}-<>-<> - persist_to_workspace: root: bin/ paths: @@ -275,7 +275,7 @@ jobs: - checkout-all - restore_cache: keys: - - v1.2-dependencies-{{ checksum "get_deps.sh" }}-cpu + - v1.2.5-dependencies-{{ checksum "get_deps.sh" }}-cpu # If no exact match is found will get dependencies from source - setup-build-system - run: @@ -309,7 +309,7 @@ jobs: - checkout-all - restore_cache: keys: - - v1.2-dependencies-{{ checksum "get_deps.sh" }}-cpu + - v1.2.5-dependencies-{{ checksum "get_deps.sh" }}-cpu # If no exact match is found will get dependencies from source - setup-build-system - run: From 7e504538ab84578e7cb2be4c9cd3f858ce21390e Mon Sep 17 00:00:00 2001 From: alon Date: Sat, 9 Oct 2021 12:33:26 +0300 Subject: [PATCH 34/45] try running tests with gpu on ci with cuda 11.2 --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4b10a1aec..e8489ebff 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -388,7 +388,7 @@ jobs: enabled: true docker_layer_caching: true resource_class: gpu.nvidia.small - image: ubuntu-1604-cuda-11.1:202012-01 + image: ubuntu-1604-cuda-11.2:202012-01 steps: - build-and-test-gpu-steps From 9d47e52b8f78c26a7c26b77942adc781cd28aee3 Mon Sep 17 00:00:00 2001 From: alon Date: Sat, 9 Oct 2021 12:39:20 +0300 Subject: [PATCH 35/45] try running tests with gpu on ci with cuda 11.2 --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e8489ebff..d5c75b0c9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -388,7 +388,7 @@ jobs: enabled: true docker_layer_caching: true resource_class: gpu.nvidia.small - image: ubuntu-1604-cuda-11.2:202012-01 + image: ubuntu-2004-cuda-11.2:202103-01 steps: - build-and-test-gpu-steps From 7e5bac5607461febce7efc2ffd9053285f9ae5d1 Mon Sep 17 00:00:00 2001 From: alon Date: Sat, 9 Oct 2021 16:15:57 +0300 Subject: [PATCH 36/45] try running tests with gpu on ci with cuda 11.2 --- opt/build/docker/dockerfile-gpu-test.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opt/build/docker/dockerfile-gpu-test.tmpl b/opt/build/docker/dockerfile-gpu-test.tmpl index 0b080967a..79a47d1c1 100644 --- a/opt/build/docker/dockerfile-gpu-test.tmpl +++ b/opt/build/docker/dockerfile-gpu-test.tmpl @@ -11,7 +11,7 @@ ARG ARCH=x64 # OS=ubuntu18.04|ubuntu16.04|centos7 ARG OS=ubuntu18.04 -ARG CUDA_VER=11.0-cudnn8 +ARG CUDA_VER=11.2-cudnn8 #---------------------------------------------------------------------------------------------- FROM redisfab/redis:{{REDIS_VERSION}}-{{REDIS_ARCH}}-{{REDIS_OSNICK}} AS redis From 2257d4c553c71a56abe70237e7fc20c1467eb954 Mon Sep 17 00:00:00 2001 From: alon Date: Sat, 9 Oct 2021 19:25:22 +0300 Subject: [PATCH 37/45] try running tests with gpu on ci with cuda 11.2 --- opt/build/docker/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opt/build/docker/Makefile b/opt/build/docker/Makefile index 871b87c79..019317d04 100755 --- a/opt/build/docker/Makefile +++ b/opt/build/docker/Makefile @@ -2,7 +2,7 @@ PRODUCT=redisai DOCKER_ORG=redislabs REDIS_VERSION=6.2.5 -REDIS_CUDA_VERSION=11.0-cudnn8 +REDIS_CUDA_VERSION=11.2-cudnn8 REDISAI_LITE=0 PACK=1 # to fetch the artifacts From d4bea6ec0aa61b8cb159c6d7a822b6a72fadb38e Mon Sep 17 00:00:00 2001 From: alon Date: Sat, 9 Oct 2021 19:43:32 +0300 Subject: [PATCH 38/45] try running tests with gpu on ci with cuda 11.2 --- opt/build/docker/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opt/build/docker/Makefile b/opt/build/docker/Makefile index 019317d04..a8ce438ed 100755 --- a/opt/build/docker/Makefile +++ b/opt/build/docker/Makefile @@ -2,7 +2,7 @@ PRODUCT=redisai DOCKER_ORG=redislabs REDIS_VERSION=6.2.5 -REDIS_CUDA_VERSION=11.2-cudnn8 +REDIS_CUDA_VERSION=11.2.2-cudnn8 REDISAI_LITE=0 PACK=1 # to fetch the artifacts From 3939c993184101b6d2a5fb1dc26016f7ad55b965 Mon Sep 17 00:00:00 2001 From: alon Date: Tue, 12 Oct 2021 10:32:41 +0300 Subject: [PATCH 39/45] Change CI machine to one with cuda 11.2 image in forked PR that run on GPU as well --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1d492d273..c5f106df1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -400,7 +400,7 @@ jobs: enabled: true docker_layer_caching: true resource_class: gpu.nvidia.small - image: ubuntu-1604-cuda-11.1:202012-01 + image: ubuntu-2004-cuda-11.2:202103-01 steps: - only_run_if_forked_pull_request From 09d914ce74bf6b4a3f0ee8e53076093f265c4ff1 Mon Sep 17 00:00:00 2001 From: alon Date: Tue, 12 Oct 2021 12:06:22 +0300 Subject: [PATCH 40/45] small fixes --- .circleci/config.yml | 2 +- opt/build/docker/dockerfile-gpu-test.tmpl | 2 - opt/build/onnxruntime/Dockerfile.x64-gpu | 43 ------------------- opt/build/tensorflow/Makefile | 3 +- .../libtorch_c/torch_extensions/torch_redis.h | 2 +- 5 files changed, 3 insertions(+), 49 deletions(-) delete mode 100644 opt/build/onnxruntime/Dockerfile.x64-gpu diff --git a/.circleci/config.yml b/.circleci/config.yml index c5f106df1..8ade29a0a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -239,7 +239,7 @@ jobs: - checkout-all - restore_cache: keys: - - v1-dependencies-{{ checksum "get_deps.sh" }}-<>-<> + - v1.2.5-deps-{{ checksum "get_deps.sh" }}-<>-<> - setup-automation # since we run in parallel, we need to generate docker files with different suffixes hence the DOCKER_SUFFIX diff --git a/opt/build/docker/dockerfile-gpu-test.tmpl b/opt/build/docker/dockerfile-gpu-test.tmpl index 79a47d1c1..2ac7f01a7 100644 --- a/opt/build/docker/dockerfile-gpu-test.tmpl +++ b/opt/build/docker/dockerfile-gpu-test.tmpl @@ -11,8 +11,6 @@ ARG ARCH=x64 # OS=ubuntu18.04|ubuntu16.04|centos7 ARG OS=ubuntu18.04 -ARG CUDA_VER=11.2-cudnn8 - #---------------------------------------------------------------------------------------------- FROM redisfab/redis:{{REDIS_VERSION}}-{{REDIS_ARCH}}-{{REDIS_OSNICK}} AS redis FROM nvidia/cuda:{{REDIS_CUDA_VERSION}}-devel-ubuntu18.04 AS builder diff --git a/opt/build/onnxruntime/Dockerfile.x64-gpu b/opt/build/onnxruntime/Dockerfile.x64-gpu deleted file mode 100644 index e691f7f4a..000000000 --- a/opt/build/onnxruntime/Dockerfile.x64-gpu +++ /dev/null @@ -1,43 +0,0 @@ -ARG OS=ubuntu18.04 -ARG CUDA_VER=11.0-cudnn8 - -FROM nvidia/cuda:11.0-cudnn8-devel-ubuntu18.04 - -ARG ONNXRUNTIME_REPO=https://github.com/RedisAI/onnxruntime -ARG ONNXRUNTIME_VER=1.7.1 -ARG ARCH=x64-gpu - -RUN apt-get -qq update -RUN apt-get -qq install -y curl \ - wget tar git build-essential \ - libcurl4-openssl-dev libssl-dev \ - libatlas-base-dev zlib1g-dev python3 python3-pip \ - python3-dev python3-numpy rsync - -RUN pip3 install --upgrade pip setuptools wheel - -RUN wget -q https://github.com/Kitware/CMake/releases/download/v3.19.5/cmake-3.19.5-Linux-x86_64.tar.gz -O /tmp/cmake.tgz -WORKDIR /tmp -RUN tar -xpf cmake.tgz -RUN rsync -aqH cmake*/* /usr - - -ENV LANG=en_US.UTF-8 -RUN apt-get install -y locales && \ - sed -i -e "s/# $LANG.*/$LANG UTF-8/" /etc/locale.gen && \ - dpkg-reconfigure --frontend=noninteractive locales && \ - update-locale LANG=$LANG - -WORKDIR /build - -ARG BUILDTYPE=MinSizeRel -ARG BUILDARGS="--config ${BUILDTYPE} --parallel" - -RUN git clone --single-branch --branch rel-${ONNXRUNTIME_VER} ${ONNXRUNTIME_REPO} onnxruntime -WORKDIR /build/onnxruntime -RUN git fetch --recurse-submodules -j4 -RUN ./build.sh ${BUILDARGS} --update --build --use_cuda --cudnn_home /usr/local/cuda --cuda_home /usr/local/cuda --build_shared_lib --parallel - -ADD ./pack.sh /build/ -WORKDIR /build -RUN ./pack.sh ${ONNXRUNTIME_VER} ${ARCH} diff --git a/opt/build/tensorflow/Makefile b/opt/build/tensorflow/Makefile index 5b9bf6263..3bd8acf61 100755 --- a/opt/build/tensorflow/Makefile +++ b/opt/build/tensorflow/Makefile @@ -7,9 +7,8 @@ export REDIS_BAZEL_VERSION PRODUCT=tensorflow DOCKER_ORG=redislabs VERSION=${REDIS_TF_VERSION} -REDIS_CUDA_VERSION=11.0-cudnn8 +REDIS_CUDA_VERSION=11.2.2-cudnn8 -export REDIS_ONNX_VERSION OSNICK=xenial ROOT=. diff --git a/src/backends/libtorch_c/torch_extensions/torch_redis.h b/src/backends/libtorch_c/torch_extensions/torch_redis.h index 4df258063..cb86adbe2 100644 --- a/src/backends/libtorch_c/torch_extensions/torch_redis.h +++ b/src/backends/libtorch_c/torch_extensions/torch_redis.h @@ -35,4 +35,4 @@ std::vector modelExecute(const std::string &model_key, int64_t num_outputs); // Register Redis and RedisAI costume ops in torch -void registerRedisOps(void); \ No newline at end of file +void registerRedisOps(void); From 5165eafed2a898e3584722850087a50752709229 Mon Sep 17 00:00:00 2001 From: alon Date: Tue, 12 Oct 2021 16:13:53 +0300 Subject: [PATCH 41/45] WIP --- Dockerfile.arm | 83 ----- Dockerfile.jetson | 102 ------ get_deps.sh | 125 +++---- opt/build/bazel/Dockerfile | 32 -- opt/build/dockerparts/base_image.tmpl | 22 -- opt/build/dockerparts/go.yml | 9 - opt/build/libtorch/Dockerfile.arm | 53 --- opt/build/libtorch/Dockerfile.jetson | 49 --- opt/build/libtorch/Dockerfile.x64 | 38 -- opt/build/libtorch/Makefile | 140 -------- opt/build/libtorch/collect.py | 82 ----- opt/build/libtorch/repack.sh | 4 +- opt/build/tensorflow-2.x/Dockerfile.jetson | 99 ----- opt/build/tensorflow-2.x/Makefile.jetson | 149 -------- opt/build/tensorflow-2.x/collect.py | 80 ----- opt/build/tensorflow/.gitignore | 2 - opt/build/tensorflow/Dockerfile.arm | 59 --- opt/build/tensorflow/Dockerfile.x64 | 81 ----- opt/build/tensorflow/Makefile | 24 -- opt/build/tensorflow/dockerfile.tmpl | 61 ---- opt/build/tensorflow/pack.sh | 21 -- opt/build/tensorflow/tf-1.14.0-arm64v8.patch | 86 ----- opt/build/tflite/Dockerfile.x64 | 29 -- opt/build/tflite/Makefile | 139 ------- opt/build/tflite/build | 20 -- opt/build/tflite/build.macos | 12 - opt/build/tflite/collect.py | 80 ----- opt/cmake/modules/FindTensorFlow.cmake | 359 ------------------- 28 files changed, 51 insertions(+), 1989 deletions(-) delete mode 100755 Dockerfile.arm delete mode 100644 Dockerfile.jetson delete mode 100755 opt/build/bazel/Dockerfile delete mode 100644 opt/build/dockerparts/base_image.tmpl delete mode 100644 opt/build/dockerparts/go.yml delete mode 100755 opt/build/libtorch/Dockerfile.arm delete mode 100755 opt/build/libtorch/Dockerfile.jetson delete mode 100755 opt/build/libtorch/Dockerfile.x64 delete mode 100755 opt/build/libtorch/Makefile delete mode 100755 opt/build/libtorch/collect.py delete mode 100644 opt/build/tensorflow-2.x/Dockerfile.jetson delete mode 100644 opt/build/tensorflow-2.x/Makefile.jetson delete mode 100644 opt/build/tensorflow-2.x/collect.py delete mode 100644 opt/build/tensorflow/.gitignore delete mode 100755 opt/build/tensorflow/Dockerfile.arm delete mode 100755 opt/build/tensorflow/Dockerfile.x64 delete mode 100755 opt/build/tensorflow/Makefile delete mode 100644 opt/build/tensorflow/dockerfile.tmpl delete mode 100755 opt/build/tensorflow/pack.sh delete mode 100755 opt/build/tensorflow/tf-1.14.0-arm64v8.patch delete mode 100755 opt/build/tflite/Dockerfile.x64 delete mode 100755 opt/build/tflite/Makefile delete mode 100755 opt/build/tflite/build delete mode 100755 opt/build/tflite/build.macos delete mode 100755 opt/build/tflite/collect.py delete mode 100755 opt/cmake/modules/FindTensorFlow.cmake diff --git a/Dockerfile.arm b/Dockerfile.arm deleted file mode 100755 index 22e609e7f..000000000 --- a/Dockerfile.arm +++ /dev/null @@ -1,83 +0,0 @@ -# BUILD redisfab/redisai:${VERSION}-cpu-${ARCH}-${OSNICK} - -ARG REDIS_VER=6.2.4 - -# OSNICK=bionic|stretch|buster -ARG OSNICK=buster - -# OS=debian:buster-slim|debian:stretch-slim|ubuntu:bionic -ARG OS=debian:buster-slim - -# ARCH=arm64v8|arm32v7 -ARG ARCH=arm64v8 - -ARG PACK=0 -ARG REDISAI_LITE=0 -ARG TEST=0 - -#---------------------------------------------------------------------------------------------- -FROM redisfab/redis:${REDIS_VER}-${ARCH}-${OSNICK} AS redis -FROM redisfab/xbuild:${ARCH}-${OS} AS builder - -ARG OSNICK -ARG OS -ARG ARCH -ARG REDIS_VER - -RUN [ "cross-build-start" ] - -RUN echo "Building for ${OSNICK} (${OS}) for ${ARCH}" - -WORKDIR /build -COPY --from=redis /usr/local/ /usr/local/ - -COPY ./opt/ opt/ -COPY ./tests/flow/tests_setup/test_requirements.txt tests/flow - -RUN ./opt/readies/bin/getpy3 -RUN ./opt/system-setup.py - -ARG DEPS_ARGS="" -COPY ./get_deps.sh . -RUN if [ "$DEPS_ARGS" = "" ]; then ./get_deps.sh cpu; else env $DEPS_ARGS ./get_deps.sh cpu; fi - -ARG BUILD_ARGS="" -ADD ./ /build -RUN set -e ;\ - . ./opt/readies/bin/sourced ./profile.d ;\ - make -C opt build $BUILD_ARGS SHOW=1 - -ARG PACK -ARG TEST - -RUN if [ "$PACK" = "1" ]; then make -C opt pack; fi -RUN if [ "$TEST" = "1" ]; then TEST= make -C opt test $BUILD_ARGS NO_LFS=1; fi - -RUN [ "cross-build-end" ] - -#---------------------------------------------------------------------------------------------- -FROM redisfab/redis-xbuild:${REDIS_VER}-${ARCH}-${OSNICK} - -RUN [ "cross-build-start" ] - -ARG OSNICK -ARG OS -ARG ARCH -ARG REDIS_VER -ARG PACK - -RUN if [ ! -z $(command -v apt-get) ]; then apt-get -qq update; apt-get -q install -y libgomp1; fi -RUN if [ ! -z $(command -v yum) ]; then yum install -y libgomp; fi - -ENV REDIS_MODULES /usr/lib/redis/modules -ENV LD_LIBRARY_PATH $REDIS_MODULES - -RUN mkdir -p $REDIS_MODULES/ - -COPY --from=builder /build/install-cpu/ $REDIS_MODULES/ - -WORKDIR /data -EXPOSE 6379 -CMD ["--loadmodule", "/usr/lib/redis/modules/redisai.so"] - -RUN [ "cross-build-end" ] diff --git a/Dockerfile.jetson b/Dockerfile.jetson deleted file mode 100644 index 34c544b71..000000000 --- a/Dockerfile.jetson +++ /dev/null @@ -1,102 +0,0 @@ -# BUILD redisfab/redisai:${VERSION}-jetson-${ARCH}-${OSNICK} - -ARG REDIS_VER=6.2.4 - -# OSNICK=bionic|centos7|centos6 -ARG OSNICK=bionic - -# OS=ubuntu18.04|ubuntu16.04|centos7 -ARG OS=ubuntu18.04 - -# ARCH=arm64v8|arm32v7 -ARG ARCH=arm64v8 - -ARG CUDA_VER=10.2-cudnn7 - -ARG L4T_VER=r32.4.4 - -ARG PACK=0 -ARG REDISAI_LITE=0 -ARG TEST=0 - -#---------------------------------------------------------------------------------------------- -FROM redisfab/redis:${REDIS_VER}-${ARCH}-${OSNICK} AS redis -FROM redisfab/jetpack:4.4.1-arm64v8-l4t as builder - -ARG OSNICK -ARG OS -ARG ARCH -ARG REDIS_VER -ARG CUDA_VER -ARG L4T_VER - -RUN echo "Building for ${OSNICK} (${OS}) for ${ARCH} [with Redis ${REDIS_VER}]" - -ENV NVIDIA_VISIBLE_DEVICES all -ENV NVIDIA_DRIVER_CAPABILITIES compute,utility - -WORKDIR /build -COPY --from=redis /usr/local/ /usr/local/ - -COPY ./opt/ opt/ -COPY ./tests/flow/tests_setup/test_requirements.txt tests/flow/ - -RUN FORCE=1 ./opt/readies/bin/getpy3 -RUN ./opt/system-setup.py - -ARG DEPS_ARGS="GPU=1 JETSON=1 WITH_PT=1 WITH_TF=1 WITH_TFLITE=0 WITH_ORT=0" -COPY ./get_deps.sh . -# RUN if [ "$DEPS_ARGS" = "" ]; then ./get_deps.sh gpu; else env $DEPS_ARGS ./get_deps.sh gpu; fi -RUN set -e ;\ - env $DEPS_ARGS ./get_deps.sh - -ARG BUILD_ARGS="GPU=1 JETSON=1 WITH_TF=1 WITH_PT=1 WITH_TFLITE=0 WITH_ORT=0" - -ADD ./ /build -RUN bash -c "set -e ;\ - . ./opt/readies/bin/sourced ./profile.d ;\ - make -C opt build $BUILD_ARGS SHOW=1" - -ARG PACK -ARG REDISAI_LITE -ARG TEST - -RUN mkdir -p bin/artifacts -RUN set -e ;\ - if [ "$PACK" = "1" ]; then make -C opt pack GPU=1; fi - -RUN set -e ;\ - if [ "$TEST" = "1" ]; then \ - TEST= make -C opt test GPU=1 $BUILD_ARGS NO_LFS=1 ;\ - if [[ -d test/logs ]]; then \ - tar -C test/logs -czf bin/artifacts/test-logs-gpu.tgz . ;\ - fi ;\ - fi - -#---------------------------------------------------------------------------------------------- -# FROM nvidia/cuda:${CUDA_VER}-runtime-${OS} -# FROM nvidia/cuda-arm64:11.1-runtime-ubuntu18.04 -# FROM nvcr.io/nvidia/l4t-base:${L4T_VER} -FROM redisfab/jetpack:4.4.1-arm64v8-l4t - -ARG OS -ARG L4T_VER - -RUN if [ ! -z $(command -v apt-get) ]; then apt-get -qq update; apt-get -q install -y libgomp1; fi -RUN if [ ! -z $(command -v yum) ]; then yum install -y libgomp; fi - -ENV REDIS_MODULES /usr/lib/redis/modules -RUN mkdir -p $REDIS_MODULES/ - -COPY --from=redis /usr/local/ /usr/local/ -COPY --from=builder /build/install-gpu/ $REDIS_MODULES/ - -COPY --from=builder /build/bin/artifacts/ /var/opt/redislabs/artifacts - -# COPY --from=builder /usr/local/etc/redis/redis.conf /usr/local/etc/redis/ - -WORKDIR /data -EXPOSE 6379 -# CMD ["/usr/local/bin/redis-server", "/usr/local/etc/redis/redis.conf", "--loadmodule", "/usr/lib/redis/modules/redisai.so"] -RUN rm -rf /root/.cache /usr/local/cuda/lib64/*.a /usr/local/cuda/doc /usr/local/cuda/samples -CMD ["/usr/local/bin/redis-server", "--loadmodule", "/usr/lib/redis/modules/redisai.so"] diff --git a/get_deps.sh b/get_deps.sh index af75ffbf7..87cf1f661 100755 --- a/get_deps.sh +++ b/get_deps.sh @@ -8,11 +8,6 @@ TF_VERSION="2.6.0" TFLITE_VERSION="2.0.0" PT_VERSION="1.9.0" -if [[ $JETSON == 1 ]]; then - PT_VERSION="1.7.0" - TF_VERSION="2.4.0" -fi - ###### END VERSIONS ###### error() { @@ -31,7 +26,6 @@ if [[ $1 == --help || $1 == help ]]; then Argument variables: CPU=1 Get CPU dependencies GPU=1 Get GPU dependencies - JETSON=1 Get Jetson dependencies VERBOSE=1 Print commands FORCE=1 Download even if present WITH_DLPACK=0 Skip dlpack @@ -86,16 +80,18 @@ DEPS_DIR=$HERE/deps/$OS-$ARCH-$DEVICE mkdir -p ${DEPS_DIR} cd ${DEPS_DIR} + +# Get the backend from its URL if is not already found and unpack it clean_and_fetch() { product=$1 archive=$2 - srcurl=$3 - nofetch=$4 + src_url=$3 + no_fetch=$4 [[ $FORCE == 1 ]] && rm -rf ${product} # FORCE is from the env [[ $FORCE != 1 ]] && [[ -d ${product} ]] && echo "${product} is in place, skipping. Set FORCE=1 to override. Continuing." && return - echo "Installing ${product} from ${srcurl} in `pwd`..." - [[ ! -e ${archive} ]] && [[ -z ${nofetch} ]] && wget -q ${srcurl} + echo "Installing ${product} from ${src_url} in `pwd`..." + [[ ! -e ${archive} ]] && [[ -z ${no_fetch} ]] && wget -q ${src_url} rm -rf ${product}.x mkdir ${product}.x tar xzf ${archive} --no-same-owner --strip-components=1 -C ${product}.x @@ -103,6 +99,21 @@ clean_and_fetch() { echo "Done." } +# This is fot torch backend, which comes in a zip file +clean_and_fetch_torch() { + archive=$1 + src_url=$2 + + [[ $FORCE == 1 ]] && rm -rf ${product} # FORCE is from the env + [[ $FORCE != 1 ]] && [[ -d ${product} ]] && echo "${product} is in place, skipping. Set FORCE=1 to override. Continuing." && return + echo "Installing ${product} from ${src_url} in `pwd`..." + + wget -q -O archive src_url + +} + + + ######################################################################################### DLPACK if [[ $WITH_DLPACK != 0 ]]; then if [[ ! -d dlpack ]]; then @@ -118,7 +129,7 @@ else fi ################################################################################## LIBTENSORFLOW -# + if [[ $OS == linux ]]; then TF_OS="linux" @@ -129,27 +140,12 @@ if [[ $OS == linux ]]; then fi if [[ $ARCH == x64 ]]; then TF_ARCH=x86_64 - LIBTF_URL_BASE=https://storage.googleapis.com/tensorflow/libtensorflow - elif [[ $ARCH == arm64v8 ]]; then - TF_ARCH=arm64 - if [[ $JETSON == 1 ]]; then - TF_BUILD="gpu-jetson" - fi - LIBTF_URL_BASE=https://s3.amazonaws.com/redismodules/tensorflow - elif [[ $ARCH == arm32v7 ]]; then - TF_ARCH=arm - LIBTF_URL_BASE=https://s3.amazonaws.com/redismodules/tensorflow - fi -elif [[ $OS == macos ]]; then - TF_OS=darwin - TF_BUILD=cpu - TF_ARCH=x86_64 - if [[ $WITH_TF == S3 ]]; then - LIBTF_URL_BASE=https://s3.amazonaws.com/redismodules/tensorflow else - LIBTF_URL_BASE=https://storage.googleapis.com/tensorflow/libtensorflow + echo "Only x64 is supported currently" fi +else + echo "Only Linux OS is supported currently" fi LIBTF_ARCHIVE=libtensorflow-${TF_BUILD}-${TF_OS}-${TF_ARCH}-${TF_VERSION}.tar.gz @@ -157,28 +153,25 @@ LIBTF_ARCHIVE=libtensorflow-${TF_BUILD}-${TF_OS}-${TF_ARCH}-${TF_VERSION}.tar.gz if [[ $WITH_TF != 0 ]]; then clean_and_fetch libtensorflow ${LIBTF_ARCHIVE} ${LIBTF_URL_BASE}/${LIBTF_ARCHIVE} else - echo "Skipping TensorFlow." + echo "Skipping TensorFlow." fi # WITH_TF ################################################################################## LIBTFLITE -# LIBTF_URL_BASE=https://s3.amazonaws.com/redismodules/tensorflow if [[ $OS == linux ]]; then TFLITE_OS="linux" if [[ $ARCH == x64 ]]; then TFLITE_ARCH=x86_64 - elif [[ $ARCH == arm64v8 ]]; then - TFLITE_ARCH=arm64 - elif [[ $ARCH == arm32v7 ]]; then - TFLITE_ARCH=arm + else + echo "Only x64 is supported currently" fi -elif [[ $OS == macos ]]; then - TFLITE_OS=darwin - TFLITE_ARCH=x86_64 +else + echo "Only Linux OS is supported currently" fi LIBTFLITE_ARCHIVE=libtensorflowlite-${TFLITE_OS}-${TFLITE_ARCH}-${TFLITE_VERSION}.tar.gz + if [[ $WITH_TFLITE != 0 ]]; then clean_and_fetch libtensorflow-lite ${LIBTFLITE_ARCHIVE} ${LIBTF_URL_BASE}/${LIBTFLITE_ARCHIVE} else @@ -186,7 +179,7 @@ else fi # WITH_TFLITE ####################################################################################### LIBTORCH -PT_REPACK=0 + PT_BUILD=cpu PT_ARCH=x86_64 if [[ $OS == linux ]]; then @@ -194,42 +187,29 @@ if [[ $OS == linux ]]; then if [[ $GPU == 1 ]]; then PT_BUILD=cu111 fi - if [[ $ARCH == x64 ]]; then PT_REPACK=1 - elif [[ $ARCH == arm64v8 ]]; then - PT_ARCH=arm64 - elif [[ $ARCH == arm32v7 ]]; then - PT_ARCH=arm - fi - - if [[ $JETSON == 1 ]]; then - PT_BUILD=cu102-jetson - PT_ARCH=arm64 + else + echo "Only x64 is supported currently" fi - -elif [[ $OS == macos ]]; then - PT_OS=macos - PT_REPACK=1 +else + echo "Only Linux OS is supported currently" fi -LIBTORCH_ARCHIVE=libtorch-${PT_BUILD}-${PT_OS}-${PT_ARCH}-${PT_VERSION}.tar.gz -LIBTORCH_URL=https://s3.amazonaws.com/redismodules/pytorch/$LIBTORCH_ARCHIVE - -if [[ $PT_REPACK == 1 ]]; then - echo "Using repack.sh from ${HERE}/opt/build/libtorch/repack.sh" - PT_VERSION=$PT_VERSION GPU=$GPU OS=${OS} ARCH=${ARCH} $HERE/opt/build/libtorch/repack.sh +if [[ $GPU != 1 ]]; then + LIBTORCH_ARCHIVE=libtorch-cxx11-abi-shared-with-deps-${PT_VERSION}%2B${PT_BUILD}.zip +else + LIBTORCH_ARCHIVE=libtorch-cxx11-abi-shared-with-deps-${PT_VERSION}%2B${PT_BUILD}.zip fi +LIBTORCH_URL=https://download.pytorch.org/libtorch/$PT_BUILD/$LIBTORCH_ARCHIVE -if [[ $WITH_PT != 0 ]] && [ $PT_REPACK != 1 ]; then - clean_and_fetch libtorch ${LIBTORCH_ARCHIVE} ${LIBTORCH_URL} -elif [[ $PT_REPACK == 1 ]]; then - clean_and_fetch libtorch ${LIBTORCH_ARCHIVE} ${LIBTORCH_URL} 1 +if [[ $WITH_PT != 0 ]]; then + clean_and_fetch_torch ${LIBTORCH_ARCHIVE} ${LIBTORCH_URL} else - echo "SKipping libtorch." + echo "Skipping libtorch." fi # WITH_PT -############################################################################# +############################################################################# ONNX ORT_URL_BASE=https://s3.amazonaws.com/redismodules/onnxruntime ORT_BUILD="" @@ -240,20 +220,15 @@ if [[ $OS == linux ]]; then fi if [[ $ARCH == x64 ]]; then ORT_ARCH=x64 - elif [[ $ARCH == arm64v8 ]]; then - ORT_ARCH=arm64 - elif [[ $ARCH == arm32v7 ]]; then - ORT_ARCH=arm + else + echo "Only x64 is supported currently" fi -elif [[ $OS == macos ]]; then - ORT_OS=osx - ORT_ARCH=x64 - ORT_URL_BASE=https://github.com/microsoft/onnxruntime/releases/download/v${ORT_VERSION} -fi +else + echo "Only Linux OS is supported currently" ORT_ARCHIVE=onnxruntime-${ORT_OS}-${ORT_ARCH}${ORT_BUILD}-${ORT_VERSION}.tgz if [[ $WITH_ORT != 0 ]]; then - clean_and_fetch onnxruntime ${ORT_ARCHIVE} ${ORT_URL_BASE}/${ORT_ARCHIVE} + clean_and_fetch onnxruntime ${ORT_ARCHIVE} ${ORT_URL_BASE}/${ORT_ARCHIVE} else echo "Skipping ONNXRuntime." fi # WITH_ORT diff --git a/opt/build/bazel/Dockerfile b/opt/build/bazel/Dockerfile deleted file mode 100755 index 7748006b7..000000000 --- a/opt/build/bazel/Dockerfile +++ /dev/null @@ -1,32 +0,0 @@ -# BUILD redisfab/bazel-${ARCH}:$(BAZ_VER) - -ARG OSNICK=buster -ARG ARCH=arm64v8 - -FROM redisfab/${ARCH}-xbuild:${OSNICK} - -RUN [ "cross-build-start" ] - -ARG BAZ_VER=0.24.1 - -WORKDIR /build - -RUN set -e ;\ - apt-get -qq update ;\ - apt-get -q install -y pkg-config g++ zlib1g-dev zip unzip python wget ;\ - apt-get -q install -y openjdk-11-jdk - -RUN set -e ;\ - wget -q https://github.com/bazelbuild/bazel/releases/download/0.24.1/bazel-0.24.1-dist.zip ;\ - unzip bazel-0.24.1-dist.zip - -RUN set -e ;\ - env EXTRA_BAZEL_ARGS="--host_javabase=@local_jdk//:jdk" bash ./compile.sh ;\ - copy bazel to /usr/local/bin - -RUN [ "cross-build-end" ] - -# FROM insready/bazel:latest as baz -# FROM ubuntu:latest -# COPY --from=baz /usr/bin/bazel* /usr/local/bin/ - diff --git a/opt/build/dockerparts/base_image.tmpl b/opt/build/dockerparts/base_image.tmpl deleted file mode 100644 index 0af08efdc..000000000 --- a/opt/build/dockerparts/base_image.tmpl +++ /dev/null @@ -1,22 +0,0 @@ -{% if REDIS_OSNICK == "xenial" %} -{% set cuda_suffix_os = "ubuntu16.04" %} -{% elif REDIS_OSNICK == "bionic" %} -{% set cuda_suffix_os = "ubuntu18.04" %} -{% endif %} - -{% if REDIS_ARCH == 'jetson' %} -FROM nvcr.io/nvidia/deepstream-l4t:5.1-21.02-base -{% endif %} - -{% if REDIS_ARCH == 'x64' %} -{% if REDIS_GPU is defined %} -FROM nvidia/cuda:{{REDIS_CUDA_VERSION}}-devel-{{cuda_suffix_os}} -{% else %} -{% if REDIS_OSNICK == "xenial" %} -FROM ubuntu:xenial -{% elif REDIS_OSNICK == "bionic" %} -FROM ubuntu:bionic -{% endif %} -{% endif %} -{% endif %} - diff --git a/opt/build/dockerparts/go.yml b/opt/build/dockerparts/go.yml deleted file mode 100644 index 4275c6298..000000000 --- a/opt/build/dockerparts/go.yml +++ /dev/null @@ -1,9 +0,0 @@ -{% if REDIS_ARCH == 'x64' %} -{% set archsuffix = 'amd64' %} -{% elif REDIS_ARCH == 'jetson' %} -{% set archsuffix = 'arm64' %} -{% endif %} - -RUN wget -q https://golang.org/dl/go1.16.5.linux-{{archsuffix}}.tar.gz -O /tmp/go.tar.gz -RUN tar -C /usr/local -zxf /tmp/go.tar.gz - diff --git a/opt/build/libtorch/Dockerfile.arm b/opt/build/libtorch/Dockerfile.arm deleted file mode 100755 index d0d305aab..000000000 --- a/opt/build/libtorch/Dockerfile.arm +++ /dev/null @@ -1,53 +0,0 @@ -# BUILD redisfab/libtorch-cpu-${ARCH}:$(PT_VER) - -# stretch|bionic|buster -ARG OSNICK=buster - -# arm32v7|arm64v8 -ARG ARCH=arm64v8 - -#---------------------------------------------------------------------------------------------- -FROM redisfab/${ARCH}-xbuild:${OSNICK} as builder - -# redeclare -ARG OSNICK -ARG ARCH - -ARG PT_VER=1.2.0 - -RUN [ "cross-build-start" ] - -WORKDIR /build - -RUN set -e ;\ - apt-get -qq update ;\ - apt-get -q install -y git build-essential ninja-build cmake python3-pip python3-cffi -RUN pip3 install setuptools pyyaml typing -RUN pip3 install numpy -# RUN pip3 install mkl mkl-include - -RUN git clone --single-branch --branch v${PT_VER} --recursive https://github.com/pytorch/pytorch.git - -ENV BUILD_PYTHON=0 -ENV USE_GLOO=1 -ENV USE_OPENCV=0 -ENV BUILD_TORCH=ON -ENV BUILD_BINARY=ON -ENV BUILD_CAFFE2_OPS=ON -ENV BUILD_TEST=0 -ENV NO_CUDA=1 -ENV NO_DISTRIBUTED=1 -ENV NO_MKLDNN=1 -ENV NO_NNPACK=1 -ENV NO_QNNPACK=1 - -RUN set -e ;\ - cd pytorch ;\ - python3 setup.py install - -ADD ./opt/readies/ /build/readies/ -ADD ./opt/build/libtorch/collect.py /build/ - -RUN ./collect.py - -RUN [ "cross-build-end" ] diff --git a/opt/build/libtorch/Dockerfile.jetson b/opt/build/libtorch/Dockerfile.jetson deleted file mode 100755 index 06cdbe1a3..000000000 --- a/opt/build/libtorch/Dockerfile.jetson +++ /dev/null @@ -1,49 +0,0 @@ -# BUILD redisfab/libtorch-cpu-${ARCH}:$(PT_VER) - -# stretch|bionic|buster -ARG OSNICK=buster - -# arm32v7|arm64v8 -ARG ARCH=aarch64 - -#---------------------------------------------------------------------------------------------- -ARG OS=nvcr.io/nvidia/deepstream-l4t:5.1-21.02-base as builder - -FROM ${OS} - -ADD ./opt/readies/ /build/readies/ -ADD ./opt/build/libtorch/collect.py /build/ - -ARG PT_VER=1.7.0 - -RUN apt-get -qq update && apt-get -q install -y git build-essential ninja-build cmake python3.7 python3-pip -RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1 - -RUN apt-get -q install -y python3-cffi python3-numpy -RUN pip3 install setuptools pyyaml typing -# RUN pip3 install mkl mkl-include - -RUN git clone --single-branch --branch v${PT_VER} --recursive https://github.com/pytorch/pytorch.git /pytorch - -ENV BUILD_PYTHON=0 -ENV USE_GLOO=1 -ENV USE_OPENCV=0 -ENV BUILD_TORCH=ON -ENV BUILD_BINARY=ON -ENV BUILD_CAFFE2_OPS=ON -ENV BUILD_TEST=0 -ENV NO_CUDA=1 -ENV NO_DISTRIBUTED=1 -ENV NO_MKLDNN=1 -ENV NO_NNPACK=1 -ENV NO_QNNPACK=1 - -RUN mkdir /pytorch/build_libtorch -WORKDIR /pytorch/build_libtorch -RUN python3 ../tools/build_libtorch.py - -ENV BUILD_SHARED_LIBS=OFF -RUN python3 ../tools/build_libtorch.py - -WORKDIR /build -RUN ./collect.py --pytorch /pytorch --pytorch-ver ${PT_VER} --dest /pytorch/dest diff --git a/opt/build/libtorch/Dockerfile.x64 b/opt/build/libtorch/Dockerfile.x64 deleted file mode 100755 index 4420a5866..000000000 --- a/opt/build/libtorch/Dockerfile.x64 +++ /dev/null @@ -1,38 +0,0 @@ -ARG OS=debian:buster - -#---------------------------------------------------------------------------------------------- -FROM ${OS} - -ARG PT_VER=1.2.0 - -WORKDIR /build - -RUN set -e ;\ - apt-get -qq update ;\ - apt-get -qq install -y git build-essential ninja-build cmake python3-pip python3-cffi -RUN pip3 install setuptools pyyaml typing -RUN pip3 install numpy -RUN pip3 install mkl mkl-include - -RUN git clone --single-branch --branch v${PT_VER} --recursive https://github.com/pytorch/pytorch.git - -ENV BUILD_PYTHON=0 -ENV USE_GLOO=1 -ENV USE_OPENCV=0 -ENV BUILD_TORCH=ON -ENV BUILD_BINARY=ON -ENV BUILD_CAFFE2_OPS=ON -ENV NO_CUDA=1 -ENV NO_DISTRIBUTED=1 -ENV NO_MKLDNN=1 -ENV NO_NNPACK=1 -ENV NO_QNNPACK=1 - -RUN set -e ;\ - cd pytorch ;\ - python3 setup.py install - -ADD ./opt/readies/ /build/readies/ -ADD ./opt/build/libtorch/collect.py /build/ - -RUN ./collect.py diff --git a/opt/build/libtorch/Makefile b/opt/build/libtorch/Makefile deleted file mode 100755 index 2b6ed42c3..000000000 --- a/opt/build/libtorch/Makefile +++ /dev/null @@ -1,140 +0,0 @@ - -ROOT=../../.. - -VERSION ?= 1.7.0 -OSNICK ?= bionic - -REDIS_VER=6.2.5 - -#---------------------------------------------------------------------------------------------- - -S3_URL=redismodules/pytorch - -OS:=$(shell $(ROOT)/opt/readies/bin/platform --os) -OSNICK:=$(shell $(ROOT)/opt/readies/bin/platform --osnick) -ARCH:=$(shell $(ROOT)/opt/readies/bin/platform --arch) -DEVICE ?= cpu - -STEM=libtorch - -DOCKER_OS.bionic=ubuntu:bionic -DOCKER_OS.stretch=debian:stretch-slim -DOCKER_OS.buster=debian:buster-slim -DOCKER_OS=$(DOCKER_OS.$(OSNICK)) - -TAR_ARCH.x64=x86_64 -TAR_ARCH.arm64v8=arm64 -TAR_ARCH.arm32v7=arm - -#---------------------------------------------------------------------------------------------- - -define targets # (1=OP, 2=op) -$(1)_TARGETS := -$(1)_TARGETS += $(if $(findstring $(X64),1),$(2)_native) -ifeq ($$(CROSS),1) -$(1)_TARGETS += $(if $(findstring $(ARM7),1),$(2)_arm32v7) -$(1)_TARGETS += $(if $(findstring $(ARM8),1),$(2)_arm64v8) -endif - -ifeq ($$(CROSS),1) -$(1)_TARGETS += $$(if $$(strip $$($(1)_TARGETS)),,$(2)_native $(2)_arm32v7 $(2)_arm64v8) -else -$(1)_TARGETS += $$(if $$(strip $$($(1)_TARGETS)),,$(2)_native) -endif -endef - -$(eval $(call targets,BUILD,build)) -$(eval $(call targets,PUBLISH,publish)) - -#---------------------------------------------------------------------------------------------- - -DOCKER_BUILD_ARGS += \ - PT_VER=$(VERSION) \ - OSNICK=$(OSNICK) \ - OS=$(DOCKER_OS) \ - ARCH=$(ARCH) - -define build_native # (1=arch, 2=tar-arch) -IID_$(1)=$(1)_$(VERSION).iid -CID_$(1)=$(1)_$(VERSION).cid - -build_native: - @docker build --iidfile $$(IID_$(1)) -t redisfab/$(STEM):$(VERSION)-$(DEVICE)-$(1) -f Dockerfile.$(VARIANT) \ - $(foreach A,$(DOCKER_BUILD_ARGS),--build-arg $(A)) $(ROOT) - @docker create --cidfile $$(CID_$(1)) `cat $$(IID_$(1))` - @docker cp `cat $$(CID_$(1))`:/pytorch/dest/$(STEM)-$(DEVICE)-$(OS)-$(2)-$(VERSION).tar.gz . - -.PHONY: build_native -endef - -ifeq ($(CROSS),1) - -define build_arm # (1=arch, 2=tar-arch) -IID_$(1)=$(1)_$(VERSION).iid -CID_$(1)=$(1)_$(VERSION).cid - -build_$(1): - @docker build --iidfile $$(IID_$(1)) -t redisfab/$(STEM):$(VERSION)-$(DEVICE)-$(1) -f Dockerfile.$(VARIANT) \ - $(foreach A,$(DOCKER_BUILD_ARGS),--build-arg $(A)) ../../.. - @docker create --cidfile $$(CID_$(1)) `cat $$(IID_$(1))` - @docker cp `cat $$(CID_$(1))`:/build/$(STEM)-$(2)-$(VERSION).tar.gz . - -.PHONY: build_$(1) -endef - -endif # CROSS - -#---------------------------------------------------------------------------------------------- - -define publish_native # (1=arch, 2=tar-arch) -publish_native: - @aws s3 cp $(STEM)-$(2)-$(VERSION).tar.gz s3://$(S3_URL)/ --acl public-read - -.PHONY: publish_native -endef - -ifeq ($(CROSS),1) - -define publish_arm # (1=arch, 2=tar-arch) -publish_$(1): - @aws s3 cp $(STEM)-$(2)-$(VERSION).tar.gz s3://$(S3_URL)/ --acl public-read - -.PHONY: publish_$(1) -endef - -endif # CROSS - -#---------------------------------------------------------------------------------------------- - -all: build publish - -build: $(BUILD_TARGETS) - -$(eval $(call build_native,$(ARCH),$(TAR_ARCH.$(ARCH)))) -ifeq ($(CROSS),1) -$(eval $(call build_arm,arm64v8,arm64)) -$(eval $(call build_arm,arm32v7,arm)) -endif - -ifneq ($(filter publish,$(MAKECMDGOALS)),) -ifeq ($(wildcard $(HOME)/.aws/credentials),) -$(error Please run 'aws configure' and provide it with access credentials) -endif -endif - -publish: $(PUBLISH_TARGETS) - -$(eval $(call publish_x64,x64,x86_64)) -ifeq ($(CROSS),1) -$(eval $(call publish_arm,arm64v8,arm64)) -$(eval $(call publish_arm,arm32v7,arm)) -endif - -repack: - @PT_VERSION=$(VERSION) GPU=$(GPU) ./repack.sh - -help: - @echo "make [build|repack|publish] [X64=1|ARM7=1|ARM8=1] [CROSS=1]" - -.PHONY: all build repack publish help - diff --git a/opt/build/libtorch/collect.py b/opt/build/libtorch/collect.py deleted file mode 100755 index a6076cb05..000000000 --- a/opt/build/libtorch/collect.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env python3 - -import os -import sys -import argparse -from pathlib import Path -import shutil -import tarfile - -# this refers to deps directory inside a container -sys.path.insert(0, os.path.join(os.path.dirname(__file__), "readies")) -import paella - -#---------------------------------------------------------------------------------------------- - -PYTORCH_VERSION = '1.7.0' - -parser = argparse.ArgumentParser(description='Prepare RedisAI dependant distribution packages.') -parser.add_argument('--pytorch', default='pytorch', help='root of pytorch repository') -parser.add_argument('--pytorch-ver', default=PYTORCH_VERSION, help='pytorch version') -parser.add_argument('--dest', default='dest', help='destination directory') -parser.add_argument('-n', '--nop', action="store_true", help='no operation') -args = parser.parse_args() - -#---------------------------------------------------------------------------------------------- - -pytorch = Path(args.pytorch).resolve() -dest = Path(args.dest).resolve() - -#---------------------------------------------------------------------------------------------- - -pt_build='cpu' - -platform = paella.Platform() - -pt_os = platform.os -if pt_os == 'macos': - pt_os = 'darwin' - -pt_arch = platform.arch -if pt_arch == 'x64': - pt_arch = 'x86_64' -elif pt_arch == 'arm64v8': - pt_arch = 'arm64' -elif pt_arch == 'arm32v7': - pt_arch = 'arm' - -pt_ver = args.pytorch_ver - -#---------------------------------------------------------------------------------------------- - -def copy_p(src, dest): - f = dest/src - paella.mkdir_p(os.path.dirname(f)) - shutil.copy(src, f, follow_symlinks=False) - -def create_tar(name, basedir, dir='.'): - def reset_uid(tarinfo): - tarinfo.uid = tarinfo.gid = 0 - tarinfo.uname = tarinfo.gname = "root" - return tarinfo - with cwd(basedir): - with tarfile.open(name, 'w:gz') as tar: - tar.add(dir, filter=reset_uid) - -def collect_pytorch(): - d_pytorch = dest/'libtorch' - with cwd(pytorch/'torch/include'): - for f in Path('.').glob('**/*.h'): - copy_p(f, d_pytorch/'include') - with cwd(pytorch/'torch/lib'): - for f in Path('.').glob('*.a'): - copy_p(f, d_pytorch/'lib') - for f in Path('.').glob('*.so*'): - copy_p(f, d_pytorch/'lib') - with cwd(pytorch/'torch'): - shutil.copytree('share', d_pytorch/'share', ignore_dangling_symlinks=True) - create_tar('libtorch-{}-{}-{}-{}.tar.gz'.format(pt_build, pt_os, pt_arch, pt_ver), dest, 'libtorch') - -#---------------------------------------------------------------------------------------------- - -collect_pytorch() diff --git a/opt/build/libtorch/repack.sh b/opt/build/libtorch/repack.sh index c8f8a15a4..d4d8be860 100755 --- a/opt/build/libtorch/repack.sh +++ b/opt/build/libtorch/repack.sh @@ -71,9 +71,7 @@ if [[ $OS == linux ]]; then LIBTORCH_ARCHIVE=libtorch-cxx11-abi-shared-with-deps-${PT_VERSION}%2B${PT_BUILD}.zip fi fi -elif [[ $OS == macos ]]; then - LIBTORCH_ARCHIVE=libtorch-${PT_OS}-${PT_VERSION}.zip -fi + [[ -z $LIBTORCH_URL ]] && LIBTORCH_URL=https://download.pytorch.org/libtorch/$PT_BUILD/$LIBTORCH_ARCHIVE diff --git a/opt/build/tensorflow-2.x/Dockerfile.jetson b/opt/build/tensorflow-2.x/Dockerfile.jetson deleted file mode 100644 index b715dc447..000000000 --- a/opt/build/tensorflow-2.x/Dockerfile.jetson +++ /dev/null @@ -1,99 +0,0 @@ - -ARG OS=ubuntu18.04 -ARG TF_VERSION=2.3.1 -ARG CUDA_VER=10.2 -ARG CUDNN_VERSION=8 -ARG TENSORRT_VERSION=7.2 -ARG MACH=aarch64 - -#---------------------------------------------------------------------------------------------- -FROM redisfab/jetpack:4.4.1-arm64v8-l4t - -ARG TF_VERSION -ARG CUDA_VERSION -ARG CUDNN_VERSION -ARG TENSORRT_VERSION - -RUN if [ ! -z $(command -v apt-get) ]; then apt-get -qq update; apt-get -q install -y git python3-h5py; fi -RUN if [ ! -z $(command -v yum) ]; then yum install -y git; fi - -WORKDIR /build - -#---------------------------------------------------------------------------------------------- - -RUN git clone https://github.com/RedisLabsModules/readies.git -RUN PIP=1 ./readies/bin/getpy3 -RUN ./readies/bin/getbazel - -#---------------------------------------------------------------------------------------------- - -ENV LANG=C.UTF-8 - -RUN ln -s $(command -v python3) /usr/local/bin/python -RUN python3 -m pip --no-cache-dir install virtualenv Pillow h5py keras_preprocessing matplotlib \ - mock 'numpy<1.19.0' future enum34 - -#---------------------------------------------------------------------------------------------- - -RUN git clone --recursive https://github.com/tensorflow/tensorflow.git - -WORKDIR /build/tensorflow/ -RUN git checkout v${TF_VERSION} - -#---------------------------------------------------------------------------------------------- - -ENV TF_NEED_CUDA=1 \ - TF_CUDA_COMPUTE_CAPABILITIES=6.1,5.3,3.5,7.2 \ - TF_NEED_TENSORRT=0 \ - \ - TF_NEED_GCP=0 \ - TF_NEED_HDFS=0 \ - TF_NEED_OPENCL=0 \ - TF_NEED_JEMALLOC=1 \ - TF_ENABLE_XLA=0 \ - TF_NEED_VERBS=0 \ - TF_CUDA_CLANG=0 \ - TF_NEED_MKL=0 \ - TF_DOWNLOAD_MKL=0 \ - TF_NEED_AWS=0 \ - TF_NEED_MPI=0 \ - TF_NEED_GDR=0 \ - TF_NEED_S3=0 \ - TF_NEED_OPENCL_SYCL=0 \ - TF_SET_ANDROID_WORKSPACE=0 \ - TF_NEED_COMPUTECPP=0 \ - TF_NEED_KAFKA=0 \ - -ENV TF_CUDA_VERSION=${CUDA_VER} \ - TF_CUDNN_VERSION=${CUDNN_VERSION} \ - TF_CUBLAS_VERSION=${TF_CUDA_VERSION} \ - TF_TENSORRT_VERSION=${TENSORRT_VERSION} \ - \ - CUDA_TOOLKIT_PATH="/usr/local/cuda-${TF_CUDA_VERSION}" \ - TF_CUDA_PATHS="/usr/include,/usr/include/cuda,/opt/cuda/include,/usr/local/cuda-${TF_CUDA_VERSION}/include,/usr/local/cuda-${TF_CUDA_VERSION}/lib64,/usr/local/cuda-${TF_CUDA_VERSION}/targets/${MACH}-linux/,/usr/local/cuda-${TF_CUDA_VERSION}/targets/${MACH}-linux/lib/,/usr/lib/${MACH}-linux-gnu,/usr/local/lib,/usr/local/cuda-${TF_CUDA_VERSION}," - \ - CUDNN_INSTALL_PATH=/usr/lib/${MACH}-linux-gnu \ - TENSORRT_INSTALL_PATH=/usr/lib/${MACH}-linux-gnu - \ - PATH="/usr/local/cuda-${TF_CUDA_VERSION}/bin:${PATH}" \ - LD_LIBRARY_PATH="/usr/local/cuda-${TF_CUDA_VERSION}/lib64:/usr/lib/${MACH}-linux-gnu:${LD_LIBRARY_PATH}" - -RUN yes "" | ./configure -RUN set -e ;\ - . /etc/profile.d/golang.sh ;\ - bazel build --jobs `/build/readies/bin/nproc` \ - --action_env=LD_LIBRARY_PATH=${LD_LIBRARY_PATH} \ - --config=v2 \ - --config=noaws \ - --config=nogcp \ - --config=nonccl \ - --config=nohdfs \ - --config=opt \ - --config=cuda \ - //tensorflow:libtensorflow.so - -#---------------------------------------------------------------------------------------------- - -WORKDIR /build -ADD collect.py /build/ -RUN python ./collect.py --version ${TF_VERSION} --variant gpu-jetson diff --git a/opt/build/tensorflow-2.x/Makefile.jetson b/opt/build/tensorflow-2.x/Makefile.jetson deleted file mode 100644 index 72133ef29..000000000 --- a/opt/build/tensorflow-2.x/Makefile.jetson +++ /dev/null @@ -1,149 +0,0 @@ - -ROOT=../../.. - -VERSION ?= 2.3.1 -OSNICK ?= bionic - -VARIANT=jetson - -#---------------------------------------------------------------------------------------------- - -OS:=$(shell $(ROOT)/opt/readies/bin/platform --os) -# OSNICK:=$(shell $(ROOT)/opt/readies/bin/platform --osnick) -OSNICK:=bionic -ARCH:=$(shell $(ROOT)/opt/readies/bin/platform --arch) -MACH:=$(shell uname -m) - -DEVICE=gpu - -DOCKER_OS.xenial=ubuntu:xenial -DOCKER_OS.bionic=ubuntu:bionic -DOCKER_OS.focal=ubuntu:focal -DOCKER_OS.stretch=debian:stretch-slim -DOCKER_OS.buster=debian:buster-slim -DOCKER_OS.centos7=centos:7.8.2003 -DOCKER_OS=$(DOCKER_OS.$(OSNICK)) - -TAR_ARCH.x64=x86_64 -TAR_ARCH.arm64v8=arm64 -TAR_ARCH.arm32v7=arm - -#---------------------------------------------------------------------------------------------- - -S3_URL=redismodules/tensorflow - -STEM=libtensorflow - -#---------------------------------------------------------------------------------------------- - -define targets # (1=OP, 2=op) -$(1)_TARGETS := -$(1)_TARGETS += $(if $(findstring $(X64),1),$(2)_native) -ifeq ($$(CROSS),1) -$(1)_TARGETS += $(if $(findstring $(ARM7),1),$(2)_arm32v7) -$(1)_TARGETS += $(if $(findstring $(ARM8),1),$(2)_arm64v8) -endif - -ifeq ($$(CROSS),1) -$(1)_TARGETS += $$(if $$(strip $$($(1)_TARGETS)),,$(2)_native $(2)_arm32v7 $(2)_arm64v8) -else -$(1)_TARGETS += $$(if $$(strip $$($(1)_TARGETS)),,$(2)_native) -endif -endef - -$(eval $(call targets,BUILD,build)) -$(eval $(call targets,PUBLISH,publish)) - -#---------------------------------------------------------------------------------------------- - -DOCKER_BUILD_ARGS += \ - TF_VER=$(VERSION) \ - OSNICK=$(OSNICK) \ - OS=$(DOCKER_OS) \ - ARCH=$(ARCH) \ - MACH=$(MACH) \ - REDIS_VER=$(REDIS_VER) \ - TEST=$(TEST) \ - PACK=$(PACK) - -define build_native # (1=arch, 2=tar-arch) -IID_$(1)=$(1)_$(VERSION).iid -CID_$(1)=$(1)_$(VERSION).cid - -build_native: - @docker build --iidfile $$(IID_$(1)) -t redisfab/$(STEM):$(VERSION)-$(DEVICE)-$(VARIANT)-$(1)-$(OSNICK) -f Dockerfile.$(VARIANT) \ - $(foreach A,$(DOCKER_BUILD_ARGS),--build-arg $(A)) . - @docker create --cidfile $$(CID_$(1)) `cat $$(IID_$(1))` - @docker cp `cat $$(CID_$(1))`:/build/dest/$(STEM)-$(DEVICE)-$(VARIANT)-$(OS)-$(2)-$(VERSION).tar.gz . - -.PHONY: build_native -endef - -ifeq ($(CROSS),1) - -define build_arm # (1=arch, 2=tar-arch) -IID_$(1)=$(1)_$(VERSION).iid -CID_$(1)=$(1)_$(VERSION).cid - -build_$(1): - @docker build --iidfile $$(IID_$(1)) -t redisfab/$(STEM):$(VERSION)-$(DEVICE)-$(1)-$(OSNICK) -f Dockerfile.$(VARIANT) \ - $(foreach A,$(DOCKER_BUILD_ARGS),--build-arg $(A)) . - @docker create --cidfile $$(CID_$(1)) `cat $$(IID_$(1))` - @docker cp `cat $$(CID_$(1))`:/build/$(STEM)-$(DEVICE)-$(VARIANT)-$(OS)-$(2)-$(VERSION).tar.gz . - -.PHONY: build_$(1) -endef - -endif # CROSS - -#---------------------------------------------------------------------------------------------- - -define publish_native # (1=arch, 2=tar-arch) -publish_native: - @aws s3 cp $(STEM)-$(DEVICE)-$(VARIANT)-$(OS)-$(2)-$(VERSION).tar.gz s3://$(S3_URL)/ --acl public-read - -.PHONY: publish_native -endef - -ifeq ($(CROSS),1) - -define publish_arm # (1=arch, 2=tar-arch) -publish_$(1): - @aws s3 cp $(STEM)-$(DEVICE)-$(VARIANT)-$(OS)-$(2)-$(VERSION).tar.gz s3://$(S3_URL)/ --acl public-read - -.PHONY: publish_$(1) -endef - -endif # CROSS - -#---------------------------------------------------------------------------------------------- - -all: build publish - -build: $(BUILD_TARGETS) - -$(eval $(call build_native,$(ARCH),$(TAR_ARCH.$(ARCH)))) -ifeq ($(CROSS),1) -$(eval $(call build_arm,arm64v8,arm64)) -$(eval $(call build_arm,arm32v7,arm)) -endif - -ifneq ($(filter publish,$(MAKECMDGOALS)),) -ifeq ($(wildcard $(HOME)/.aws/credentials),) -$(error Please run 'aws configure' and provide it with access credentials) -endif -endif - -publish: $(PUBLISH_TARGETS) - -$(eval $(call publish_native,$(ARCH),$(TAR_ARCH.$(ARCH)))) -ifeq ($(CROSS),1) -$(eval $(call publish_arm,arm64v8,arm64)) -$(eval $(call publish_arm,arm32v7,arm)) -endif - - -help: - @echo "make [build|publish] [X64=1|ARM7=1|ARM8=1] [CROSS=1]" - -.PHONY: all build publish help diff --git a/opt/build/tensorflow-2.x/collect.py b/opt/build/tensorflow-2.x/collect.py deleted file mode 100644 index 4fd1246fd..000000000 --- a/opt/build/tensorflow-2.x/collect.py +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/env python3 - -import os -import sys -import argparse -from pathlib import Path -import shutil -import tarfile - -# this refers to deps directory inside a container -sys.path.insert(0, os.path.join(os.path.dirname(__file__), "readies")) -import paella - -#---------------------------------------------------------------------------------------------- - -TENSORFLOW_VERSION = '2.3.1' -VARIANT='gpu-jetson' - -parser = argparse.ArgumentParser(description='Prepare RedisAI dependant distribution packages.') -parser.add_argument('--root', default='tensorflow', help='root of tensorflow repository') -parser.add_argument('--version', default=TENSORFLOW_VERSION, help='tensorflow version') -parser.add_argument('--variant', default=VARIANT, help='build variant') -parser.add_argument('--dest', default='dest', help='destination directory') -parser.add_argument('-n', '--nop', action="store_true", help='no operation') -args = parser.parse_args() - -#---------------------------------------------------------------------------------------------- - -tensorflow = Path(args.root).resolve() -dest = Path(args.dest).resolve() - -#---------------------------------------------------------------------------------------------- - -tf_build=args.variant - -platform = paella.Platform() - -tf_os = platform.os -if tf_os == 'macos': - tf_os = 'darwin' - -tf_arch = platform.arch -if tf_arch == 'x64': - tf_arch = 'x86_64' -elif tf_arch == 'arm64v8': - tf_arch = 'arm64' - -tf_ver = args.version - -#---------------------------------------------------------------------------------------------- - -def copy_p(src, dest): - f = dest/src - paella.mkdir_p(os.path.dirname(f)) - shutil.copy(src, f, follow_symlinks=False) - -def create_tar(name, basedir, dir='.'): - def reset_uid(tarinfo): - tarinfo.uid = tarinfo.gid = 0 - tarinfo.uname = tarinfo.gname = "root" - return tarinfo - with cwd(basedir): - with tarfile.open(name, 'w:gz') as tar: - tar.add(dir, filter=reset_uid) - -def collect_tensorflow(): - d_tensorflow = dest #/'tensorflow' - with cwd(tensorflow): - for f in Path('tensorflow/c').glob('**/*.h'): - copy_p(f, d_tensorflow/'include') - with cwd(tensorflow/'bazel-bin'/'tensorflow'): - for f in Path('.').glob('*.so*'): - if str(f).endswith(".params"): - continue - copy_p(f, d_tensorflow/'lib') - create_tar(dest/f'libtensorflow-{tf_build}-{tf_os}-{tf_arch}-{tf_ver}.tar.gz', dest) - -#---------------------------------------------------------------------------------------------- - -collect_tensorflow() diff --git a/opt/build/tensorflow/.gitignore b/opt/build/tensorflow/.gitignore deleted file mode 100644 index f4199305e..000000000 --- a/opt/build/tensorflow/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -Dockerfile -*.cid diff --git a/opt/build/tensorflow/Dockerfile.arm b/opt/build/tensorflow/Dockerfile.arm deleted file mode 100755 index e8fa9fce5..000000000 --- a/opt/build/tensorflow/Dockerfile.arm +++ /dev/null @@ -1,59 +0,0 @@ -# BUILD redisfab/libtensorflow:${TF_VER}-cpu-${OSNICK}-${ARCH} - -# stretch|bionic|buster -ARG OSNICK=buster - -# arm32v7|arm64v8 -ARG ARCH=arm64v8 - -#---------------------------------------------------------------------------------------------- -FROM redisfab/${ARCH}-jdk-xbuild:${OSNICK} - -RUN [ "cross-build-start" ] - -ARG ARCH - -ARG TF_BRANCH=r1.15 -ARG TF_VER=1.15.0 - -ENV DEBIAN_FRONTEND=noninteractive -ENV TF_IGNORE_MAX_BAZEL_VERSION=1 - -WORKDIR /build - -RUN apt-get -qq update -RUN apt-get -q install -y git build-essential python3 python3-dev python3-pip wget - -RUN set -e ;\ - wget -q -O /usr/local/bin/bazel https://s3.amazonaws.com/redismodules/bazel/bazel-0.24.1.${ARCH} ;\ - chmod +x /usr/local/bin/bazel - -RUN pip3 install wheel setuptools -RUN pip3 install six numpy mock -RUN pip3 install keras_applications==1.0.6 --no-deps -RUN pip3 install keras_preprocessing==1.0.5 --no-deps - -# RUN set -e ;\ -# mkdir -p /usr/share/man/man1 ;\ -# apt-get -q install -y openjdk-11-jdk - -RUN set -e ;\ - git clone --single-branch --branch ${TF_BRANCH} --recursive https://github.com/tensorflow/tensorflow.git ;\ - cd tensorflow ;\ - git checkout v${TF_VER} - -RUN set -e ;\ - cd tensorflow ;\ - patch -p1 -i ../tf-1.15.0-arm64v8.patch - -RUN set -e ;\ - cd tensorflow ;\ - ./configure ;\ - bazel build --jobs $(ncpus) --config=opt //tensorflow:libtensorflow.so - -ADD ./opt/readies/ /build/readies/ -ADD ./opt/build/tensorflow/collect.py /build/ - -RUN ./collect.py - -RUN [ "cross-build-end" ] diff --git a/opt/build/tensorflow/Dockerfile.x64 b/opt/build/tensorflow/Dockerfile.x64 deleted file mode 100755 index 77a12f6e3..000000000 --- a/opt/build/tensorflow/Dockerfile.x64 +++ /dev/null @@ -1,81 +0,0 @@ -# BUILD redisfab/tensorflow:${TF_VER}-x64-${OSNICK} - -ARG OS=debian:buster - -#---------------------------------------------------------------------------------------------- -# FROM insready/bazel:latest as bazel -FROM ${OS} - - -ARG TF_BRANCH=r1.15 -ARG TF_VER=1.15.0 - -ENV DEBIAN_FRONTEND=noninteractive -ENV X_NPROC "cat /proc/cpuinfo|grep processor|wc -l" -ENV TF_IGNORE_MAX_BAZEL_VERSION=1 - -WORKDIR /build - -# COPY --from=bazel /usr/bin/bazel* /usr/local/bin/ - -RUN apt-get -qq update -RUN apt-get -q install -y git build-essential python3-dev python3-pip wget -RUN ln -s /usr/bin/python3 /usr/bin/python - -RUN set -e ;\ - wget -q -O /usr/local/bin/bazel https://s3.amazonaws.com/redismodules/bazel/bazel-0.24.1.x64 ;\ - chmod +x /usr/local/bin/bazel - -RUN pip3 install wheel setuptools -RUN pip3 install six numpy mock -RUN pip3 install keras_applications==1.0.6 --no-deps -RUN pip3 install keras_preprocessing==1.0.5 --no-deps - -RUN set -e ;\ - mkdir -p /usr/share/man/man1 ;\ - apt-get -q install -y openjdk-11-jdk - -RUN set -e ;\ - git clone --single-branch --branch ${TF_BRANCH} --recursive https://github.com/tensorflow/tensorflow.git ;\ - cd tensorflow ;\ - git checkout v${TF_VER} - -# from https://gist.github.com/PatWie/0c915d5be59a518f934392219ca65c3d -# ENV PYTHON_BIN_PATH=$(which ${python_version}) -# ENV PYTHON_LIB_PATH="$($PYTHON_BIN_PATH -c 'import site; print(site.getsitepackages()[0])')" -# ENV PYTHONPATH=${TF_ROOT}/lib -# ENV PYTHON_ARG=${TF_ROOT}/lib - -# ENV CUDA_TOOLKIT_PATH=${opt}/cuda/toolkit_8.0/cuda -# ENV CUDNN_INSTALL_PATH=${opt}/cuda/cudnn/6/cuda - -ENV TF_NEED_GCP=0 -ENV TF_NEED_CUDA=0 -# ENV TF_CUDA_COMPUTE_CAPABILITIES=6.1,5.2,3.5 -ENV TF_NEED_HDFS=0 -ENV TF_NEED_OPENCL=0 -ENV TF_NEED_JEMALLOC=1 -ENV TF_ENABLE_XLA=0 -ENV TF_NEED_VERBS=0 -ENV TF_CUDA_CLANG=0 -ENV TF_NEED_MKL=0 -ENV TF_DOWNLOAD_MKL=0 -ENV TF_NEED_AWS=0 -ENV TF_NEED_MPI=0 -ENV TF_NEED_GDR=0 -ENV TF_NEED_S3=0 -ENV TF_NEED_OPENCL_SYCL=0 -ENV TF_SET_ANDROID_WORKSPACE=0 -ENV TF_NEED_COMPUTECPP=0 -ENV TF_NEED_KAFKA=0 -ENV TF_NEED_TENSORRT=0 - -RUN set -e ;\ - cd tensorflow ;\ - ./configure ;\ - bazel build --jobs $(eval "$X_NPROC") --config=opt //tensorflow:libtensorflow.so - -ADD ./opt/readies/ /build/readies/ -ADD ./opt/build/tensorflow/collect.py /build/ - -RUN ./collect.py diff --git a/opt/build/tensorflow/Makefile b/opt/build/tensorflow/Makefile deleted file mode 100755 index 3bd8acf61..000000000 --- a/opt/build/tensorflow/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -REDIS_BAZEL_VERSION?=3.5 -REDIS_TF_VERSION?=2.6.0 - -export REDIS_TF_VERSION -export REDIS_BAZEL_VERSION - -PRODUCT=tensorflow -DOCKER_ORG=redislabs -VERSION=${REDIS_TF_VERSION} -REDIS_CUDA_VERSION=11.2.2-cudnn8 - -OSNICK=xenial - -ROOT=. -UNAME_MACHINE=$(shell uname -m) -ifeq ($(GPU),1) -BACKEND_NAME=lib${PRODUCT}-gpu-${OS}-${UNAME_MACHINE}-${REDIS_TF_VERSION}.tar.gz -else -BACKEND_NAME=lib${PRODUCT}-cpu-${OS}-${UNAME_MACHINE}-${REDIS_TF_VERSION}.tar.gz -endif - -READIES=${ROOT}/../../readies - -include ../backends.rules diff --git a/opt/build/tensorflow/dockerfile.tmpl b/opt/build/tensorflow/dockerfile.tmpl deleted file mode 100644 index eab2f9975..000000000 --- a/opt/build/tensorflow/dockerfile.tmpl +++ /dev/null @@ -1,61 +0,0 @@ -{% include 'base_image.tmpl' %} - -{% include 'apt.yml' %} - -RUN apt install -y openjdk-8-jdk openjdk-8-jre-headless rsync -RUN ln -s /usr/bin/python3 /usr/bin/python -RUN python3 -m pip install --upgrade pip setuptools wheel -RUN python3 -m pip install mock numpsy six -RUN python3 -m pip install keras_preprocessing --no-deps - -{% include 'go.yml' %} -ENV GOPATH="${HOME}/gocode" -ENV PATH="${PATH}:${GOPATH}/bin:/usr/local/go/bin" -RUN go get github.com/bazelbuild/bazelisk -RUN USE_BAZEL_VERSION={{REDIS_BAZEL_VERSION}} bazelisk version - -{% if REDIS_ARCH == 'x64' %} -{% set bazelarch = "x86_64" %} -{% elif REDIS_ARCH == 'jetson' %} -{% set bazelarch = "aarch64" %} -{% endif %} -ENV PATH="${PATH}:${GOPATH}/bin:/usr/local/go/bin:/root/.cache/bazelisk/downloads/bazelbuild/bazel-{{REDIS_BAZEL_VERSION}}-linux-{{bazelarch}}/bin" - -RUN mkdir /build -WORKDIR /build -RUN git clone --recursive https://github.com/tensorflow/tensorflow.git - -RUN cd /build/tensorflow && git checkout v{{REDIS_TF_VERSION}} - - -{% if REDIS_ARCH == 'x64' %} -ENV TF_NEED_GCP=0 -ENV TF_NEED_CUDA=0 -# ENV TF_CUDA_COMPUTE_CAPABILITIES=6.1,5.2,3.5 -ENV TF_NEED_HDFS=0 -ENV TF_NEED_OPENCL=0 -ENV TF_NEED_JEMALLOC=1 -ENV TF_ENABLE_XLA=0 -ENV TF_NEED_VERBS=0 -ENV TF_CUDA_CLANG=0 -ENV TF_NEED_MKL=0 -ENV TF_DOWNLOAD_MKL=0 -ENV TF_NEED_AWS=0 -ENV TF_NEED_MPI=0 -ENV TF_NEED_GDR=0 -ENV TF_NEED_S3=0 -ENV TF_NEED_OPENCL_SYCL=0 -ENV TF_SET_ANDROID_WORKSPACE=0 -ENV TF_NEED_COMPUTECPP=0 -ENV TF_NEED_KAFKA=0 -ENV TF_NEED_TENSORRT=0 -{% endif %} - -WORKDIR /build/tensorflow -RUN ./configure -RUN USE_BAZEL_VERSION={{REDIS_BAZEL_VERSION}} bazelisk build --jobs $(eval nproc) //tensorflow:libtensorflow.so - -ADD ./pack.sh /build/ - -WORKDIR /build -RUN ./pack.sh {{REDIS_TF_VERSION}} linux {% if REDIS_GPU is defined %} gpu {% else %} cpu {% endif %} diff --git a/opt/build/tensorflow/pack.sh b/opt/build/tensorflow/pack.sh deleted file mode 100755 index 11e961ec6..000000000 --- a/opt/build/tensorflow/pack.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -VERSION=$1 # 2.5.0 -BASEOS=$2 # linux -VARIANT=$3 # cpu or gpu -if [ ! -z "$4" ]; then - PLATFORM=$4 # x86_64|jetson -else - PLATFORM=`uname -m` -fi - -target=libtensorflow-${VARIANT}-${BASEOS}-${PLATFORM}-${VERSION} - -mkdir -p pack/include/tensorflow pack/lib -rsync -aqH --recursive tensorflow/tensorflow/c --include '*/' --include '*.h' --exclude '*' pack/include/tensorflow -rsync -aqH --recursive tensorflow/tensorflow/core --include '*/' --include '*.h' --exclude '*' pack/include/tensorflow -cp tensorflow/LICENSE pack -cp tensorflow/bazel-bin/tensorflow/libtensorflow.so pack/lib -cp tensorflow/bazel-bin/tensorflow/*so* pack/lib -mv pack ${target} -tar czf ${target}.tar.gz ${target}/ diff --git a/opt/build/tensorflow/tf-1.14.0-arm64v8.patch b/opt/build/tensorflow/tf-1.14.0-arm64v8.patch deleted file mode 100755 index b586004dc..000000000 --- a/opt/build/tensorflow/tf-1.14.0-arm64v8.patch +++ /dev/null @@ -1,86 +0,0 @@ ---- old/tensorflow/lite/python/interpreter.py 2019-06-18 22:48:23.000000000 +0000 -+++ new/tensorflow/lite/python/interpreter.py 2019-07-20 15:11:41.659061160 +0000 -@@ -305,3 +305,7 @@ - - def reset_all_variables(self): - return self._interpreter.ResetVariableTensors() -+ -+ def set_num_threads(self, i): -+ return self._interpreter.SetNumThreads(i) -+ ---- old/tensorflow/lite/python/interpreter_wrapper/interpreter_wrapper.cc 2019-06-18 22:48:23.000000000 +0000 -+++ new/tensorflow/lite/python/interpreter_wrapper/interpreter_wrapper.cc 2019-07-20 15:12:36.115293826 +0000 -@@ -446,5 +446,10 @@ - Py_RETURN_NONE; - } - -+PyObject* InterpreterWrapper::SetNumThreads(int i) { -+ interpreter_->SetNumThreads(i); -+ Py_RETURN_NONE; -+} -+ - } // namespace interpreter_wrapper - } // namespace tflite ---- old/tensorflow/lite/python/interpreter_wrapper/interpreter_wrapper.h 2019-06-18 22:48:23.000000000 +0000 -+++ new/tensorflow/lite/python/interpreter_wrapper/interpreter_wrapper.h 2019-07-20 15:13:38.971563310 +0000 -@@ -72,6 +72,8 @@ - // should be the interpreter object providing the memory. - PyObject* tensor(PyObject* base_object, int i); - -+ PyObject* SetNumThreads(int i); -+ - private: - // Helper function to construct an `InterpreterWrapper` object. - // It only returns InterpreterWrapper if it can construct an `Interpreter`. ---- old/tensorflow/lite/tools/make/Makefile 2019-06-18 22:48:23.000000000 +0000 -+++ new/tensorflow/lite/tools/make/Makefile 2019-07-20 15:14:13.823713121 +0000 -@@ -150,7 +150,7 @@ - CORE_CC_EXCLUDE_SRCS += tensorflow/lite/mmap_allocation_disabled.cc - endif - --BUILD_WITH_NNAPI=true -+BUILD_WITH_NNAPI=false - ifeq ($(BUILD_TYPE),micro) - BUILD_WITH_NNAPI=false - endif ---- old/tensorflow/lite/tools/make/targets/aarch64_makefile.inc 2019-06-18 22:48:23.000000000 +0000 -+++ new/tensorflow/lite/tools/make/targets/aarch64_makefile.inc 2019-07-20 15:16:40.396345748 +0000 -@@ -9,12 +9,16 @@ - -march=armv8-a \ - -funsafe-math-optimizations \ - -ftree-vectorize \ -+ -flax-vector-conversions \ -+ -fomit-frame-pointer \ - -fPIC - - CFLAGS += \ - -march=armv8-a \ - -funsafe-math-optimizations \ - -ftree-vectorize \ -+ -flax-vector-conversions \ -+ -fomit-frame-pointer \ - -fPIC - - LDFLAGS := \ -@@ -28,6 +32,7 @@ - -lstdc++ \ - -lpthread \ - -lm \ -- -ldl -+ -ldl \ -+ -rt - - endif ---- old/tensorflow/lite/build_def.bzl 2019-06-18 22:48:23.000000000 +0000 -+++ new/tensorflow/lite/build_def.bzl 2019-07-20 15:18:18.836772593 +0000 -@@ -32,6 +32,10 @@ - "/DTF_COMPILE_LIBRARY", - "/wd4018", # -Wno-sign-compare - ], -+ str(Label("//tensorflow:linux_aarch64")): [ -+ "-flax-vector-conversions", -+ "-fomit-frame-pointer", -+ ], - "//conditions:default": [ - "-Wno-sign-compare", - ], diff --git a/opt/build/tflite/Dockerfile.x64 b/opt/build/tflite/Dockerfile.x64 deleted file mode 100755 index 53a474c69..000000000 --- a/opt/build/tflite/Dockerfile.x64 +++ /dev/null @@ -1,29 +0,0 @@ - -ARG OS=debian:buster - -ARG FTLITE_VER=2.0.0 - -#---------------------------------------------------------------------------------------------- -FROM ${OS} - -ARG FTLITE_VER - -WORKDIR /build - -RUN set -e ;\ - apt-get -qq update ;\ - apt-get -q install -y git ca-certificates curl wget unzip python3 ;\ - apt-get -q install -y git build-essential zlib1g-dev - -RUN git clone --single-branch --branch v${FTLITE_VER} --depth 1 https://github.com/tensorflow/tensorflow.git - -ADD ./opt/build/tflite/build /build/ -ADD ./opt/readies/ /build/readies/ -ADD ./opt/build/tflite/collect.py /build/ - -RUN set -e ;\ - cd tensorflow/tensorflow/lite/tools/make ;\ - ./download_dependencies.sh ;\ - ./build_lib.sh - -RUN ./collect.py --version ${FTLITE_VER} --dest /build/dest diff --git a/opt/build/tflite/Makefile b/opt/build/tflite/Makefile deleted file mode 100755 index 8962177b7..000000000 --- a/opt/build/tflite/Makefile +++ /dev/null @@ -1,139 +0,0 @@ - -ROOT=../../.. - -export VERSION ?= 2.0.0 -OSNICK ?= buster - -#---------------------------------------------------------------------------------------------- - -S3_URL=redismodules/tensorflow - -OS:=$(shell $(ROOT)/opt/readies/bin/platform --os) - -ifeq ($(OS),linux) -OS.publish:=$(OS) -ARCH.publish:=$(ARCH) - -else ifeq ($(OS),macos) -OS.publish:=darwin -ARCH.publish:=x86_64 -endif - -STEM=libtensorflowlite-$(OS.publish) - -DOCKER_OS.bionic=ubuntu:bionic -DOCKER_OS.stretch=debian:stretch-slim -DOCKER_OS.buster=debian:buster-slim -DOCKER_OS=$(DOCKER_OS.$(OSNICK)) - -#---------------------------------------------------------------------------------------------- - -ifeq ($(OS),linux) - -define targets # (1=OP, 2=op) -$(1)_TARGETS := -$(1)_TARGETS += $(if $(findstring $(X64),1),$(2)_x64) -$(1)_TARGETS += $(if $(findstring $(ARM7),1),$(2)_arm32v7) -$(1)_TARGETS += $(if $(findstring $(ARM8),1),$(2)_arm64v8) - -$(1)_TARGETS += $$(if $$(strip $$($(1)_TARGETS)),,$(2)_x64 $(2)_arm32v7 $(2)_arm64v8) -endef - -else ifeq ($(OS),macos) - -define targets # (1=OP, 2=op) -$(1)_TARGETS := $(2)_x64 -endef - -endif - -$(eval $(call targets,BUILD,build)) -$(eval $(call targets,PUBLISH,publish)) - -#---------------------------------------------------------------------------------------------- - -define build_x64 # (1=arch, 2=tar-arch) -IID_$(1)=$(1)_$(VERSION).iid -CID_$(1)=$(1)_$(VERSION).cid - -build_x64: - @docker build --iidfile $$(IID_$(1)) -t redisfab/$(STEM)-$(1):$(VERSION) -f Dockerfile.x64 \ - --build-arg OS=$(DOCKER_OS) $(ROOT) - @docker create --cidfile $$(CID_$(1)) `cat $$(IID_$(1))` - @docker cp `cat $$(CID_$(1))`:/build/dest/$(STEM)-$(2)-$(VERSION).tar.gz . - -.PHONY: build_x64 -endef - -define build_arm # (1=arch, 2=tar-arch) -IID_$(1)=$(1)_$(VERSION).iid -CID_$(1)=$(1)_$(VERSION).cid - -build_$(1): - @docker build --iidfile $$(IID_$(1)) -t redisfab/$(STEM)-$(1):$(VERSION) -f Dockerfile.arm \ - --build-arg ARCH=$(1) $(ROOT) - @docker create --cidfile $$(CID_$(1)) `cat $$(IID_$(1))` - @docker cp `cat $$(CID_$(1))`:/build/$(STEM)-$(2)-$(VERSION).tar.gz . - -.PHONY: build_$(1) -endef - -#---------------------------------------------------------------------------------------------- - -define publish_x64 # (1=arch, 2=tar-arch) -publish_x64: - @aws s3 cp $(STEM)-$(2)-$(VERSION).tar.gz s3://$(S3_URL)/ --acl public-read - -.PHONY: publish_x64 -endef - -define publish_arm # (1=arch, 2=tar-arch) -publish_$(1): - @aws s3 cp $(STEM)-$(2)-$(VERSION).tar.gz s3://$(S3_URL)/ --acl public-read - -.PHONY: publish_$(1) -endef - -#---------------------------------------------------------------------------------------------- - -all: build publish - -ifeq ($(OS),linux) - -build: $(BUILD_TARGETS) - -$(eval $(call build_x64,x64,x86_64)) -$(eval $(call build_arm,arm64v8,arm64)) -$(eval $(call build_arm,arm32v7,arm)) - -ifneq ($(filter publish,$(MAKECMDGOALS)),) -ifeq ($(wildcard $(HOME)/.aws/credentials),) -$(error Please run 'aws configure' and provide it with access credentials) -endif -endif - -publish: $(PUBLISH_TARGETS) - -$(eval $(call publish_x64,x64,x86_64)) -$(eval $(call publish_arm,arm64v8,arm64)) -$(eval $(call publish_arm,arm32v7,arm)) - -help: - @echo "make [build|publish] [X64=1|ARM7=1|ARM8=1]" - -else ifeq ($(OS),macos) - -build: - @VERSION=$(VERSION) ./build.macos - @mv macos/dest/$(STEM)-$(ARCH.publish)-$(VERSION).tar.gz . - -publish: $(PUBLISH_TARGETS) - -$(eval $(call publish_x64,x64,x86_64)) - -help: - @echo "make [build|publish]" - -endif # macos - -.PHONY: all build publish help diff --git a/opt/build/tflite/build b/opt/build/tflite/build deleted file mode 100755 index ba9a8cb71..000000000 --- a/opt/build/tflite/build +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -OS=$(python3 readies/bin/platform --os) -ARCH=$(python3 readies/bin/platform --arch) - -cd tensorflow/tensorflow/lite/tools/make -bash download_dependencies.sh -if [[ $OS == linux ]]; then - TARGET=linux - if [[ $ARCH == x64 ]]; then - bash build_lib.sh - elif [[ $ARCH == arm64v8 ]]; then - bash build_aarch64_lib.sh - elif [[ $ARCH == arm32v7 ]]; then - bash build_rpi_lib.sh - fi -elif [[ $OS == macos ]]; then - TARGET=osx - bash build_lib.sh -fi diff --git a/opt/build/tflite/build.macos b/opt/build/tflite/build.macos deleted file mode 100755 index 316d38e0f..000000000 --- a/opt/build/tflite/build.macos +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" -cd $HERE - -set -e -mkdir -p macos -cd macos -cp ../collect.py . -ln -s ../../../readies/ -git clone --single-branch --branch v${VERSION} --depth 1 https://github.com/tensorflow/tensorflow.git -./collect.py --version $VERSION --dest dest diff --git a/opt/build/tflite/collect.py b/opt/build/tflite/collect.py deleted file mode 100755 index 4d4e4b347..000000000 --- a/opt/build/tflite/collect.py +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/env python3 - -import os -import sys -import argparse -from pathlib import Path -import shutil -import tarfile - -# this refers to deps directory inside a container -sys.path.insert(0, os.path.join(os.path.dirname(__file__), "readies")) -import paella - -#---------------------------------------------------------------------------------------------- - -TFLITE_VERSION = '2.0.0' - -parser = argparse.ArgumentParser(description='Prepare RedisAI dependant distribution packages.') -parser.add_argument('--tensorflow', default='tensorflow', help='root of tensorflow repository') -parser.add_argument('--version', default=TFLITE_VERSION, help='tensorflow version') -parser.add_argument('--dest', default='dest', help='destination directory') -parser.add_argument('-n', '--nop', action="store_true", help='no operation') -args = parser.parse_args() - -#---------------------------------------------------------------------------------------------- - -tensorflow = Path(args.tensorflow).resolve() -dest = Path(args.dest).resolve() - -#---------------------------------------------------------------------------------------------- - -platform = paella.Platform() - -tf_os = platform.os -tf_os_internal = tf_os -if tf_os == 'macos': - tf_os = 'darwin' - tf_os_internal = 'osx' - -tf_arch = platform.arch -if tf_arch == 'x64': - tf_arch = 'x86_64' -elif tf_arch == 'arm64v8': - tf_arch = 'arm64' - -tf_ver = args.version - -#---------------------------------------------------------------------------------------------- - -def copy_p(src, dest): - f = dest/src - paella.mkdir_p(os.path.dirname(f)) - shutil.copy(src, f, follow_symlinks=False) - -def create_tar(name, basedir, dir='.'): - def reset_uid(tarinfo): - tarinfo.uid = tarinfo.gid = 0 - tarinfo.uname = tarinfo.gname = "root" - return tarinfo - with cwd(basedir): - with tarfile.open(name, 'w:gz') as tar: - tar.add(dir, filter=reset_uid) - -def collect_tflite(): - d_tensorflow = dest - with cwd(tensorflow): - for f in Path('tensorflow/lite').glob('**/*.h'): - copy_p(f, d_tensorflow/'include') - with cwd('tensorflow/lite/tools/make'): - with cwd('downloads/flatbuffers/include'): - for f in Path('.').glob('**/*.h'): - copy_p(f, d_tensorflow/'include') - with cwd(f'gen/{tf_os_internal}_{tf_arch}/lib'): - for f in Path('.').glob('*.a'): - copy_p(f, d_tensorflow/'lib') - create_tar(dest/f'libtensorflowlite-{tf_os}-{tf_arch}-{tf_ver}.tar.gz', dest) - -#---------------------------------------------------------------------------------------------- - -collect_tflite() diff --git a/opt/cmake/modules/FindTensorFlow.cmake b/opt/cmake/modules/FindTensorFlow.cmake deleted file mode 100755 index 4b5423950..000000000 --- a/opt/cmake/modules/FindTensorFlow.cmake +++ /dev/null @@ -1,359 +0,0 @@ -# Patrick Wieschollek, -# FindTensorFlow.cmake -# https://github.com/PatWie/tensorflow-cmake/blob/master/cmake/modules/FindTensorFlow.cmake -# ------------- -# -# Find TensorFlow library and includes -# -# Automatically set variables have prefix "TensorFlow_", -# while environmental variables you can specify have prefix "TENSORFLOW_" -# This module will set the following variables in your project: -# -# ``TensorFlow_VERSION`` -# exact TensorFlow version obtained from runtime -# ``TensorFlow_ABI`` -# ABI specification of TensorFlow library obtained from runtime -# ``TensorFlow_INCLUDE_DIR`` -# where to find tensorflow header files obtained from runtime -# ``TensorFlow_LIBRARY`` -# the libraries to link against to use TENSORFLOW obtained from runtime -# ``TensorFlow_FOUND TRUE`` -# If false, do not try to use TENSORFLOW. -# ``TensorFlow_C_LIBRARY`` -# Path to tensorflow_cc library (libtensorflow[.so,.dylib,.dll], or similar) -# -# for some examples, you will need to specify on of the following cmake variables: -# ``TensorFlow_BUILD_DIR`` Is the directory containing the tensorflow_cc library, which can be initialized -# with env-var 'TENSORFLOW_BUILD_DIR' environmental variable -# ``TensorFlow_SOURCE_DIR`` Is the path to source of TensorFlow, which can be initialized -# with env-var 'TENSORFLOW_SOURCE_DIR' environmental variable -# -# -# USAGE -# ------ -# add "list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}../../path/to/this/file)" to your project -# -# "add_tensorflow_gpu_operation" is a macro to compile a custom operation -# -# add_tensorflow_gpu_operation("") expects the following files to exists: -# - kernels/_kernel.cc -# - kernels/_kernel_gpu.cu.cc (kernels/_kernel.cu is supported as well) -# - kernels/_op.cc -# - kernels/_op.h -# - ops/.cc - -if(APPLE) - message(WARNING "This FindTensorflow.cmake is not tested on APPLE\n" - "Please report if this works\n" - "https://github.com/PatWie/tensorflow-cmake") -endif() - -if(WIN32) - message(WARNING "This FindTensorflow.cmake is not tested on WIN32\n" - "Please report if this works\n" - "https://github.com/PatWie/tensorflow-cmake") -endif() - -set(PYTHON_EXECUTABLE "python3" CACHE STRING "specify the python version TensorFlow is installed on.") - -if(TensorFlow_FOUND AND EXISTS "${TensorFlow_LIBRARY}" AND IS_DIRECTORY "${TensorFlow_INCLUDE_DIR}") - # reuse cached variables - message(STATUS "Reuse cached information from TensorFlow ${TensorFlow_VERSION} ") -else() - message(STATUS "Detecting TensorFlow using ${PYTHON_EXECUTABLE}" - " (use -DPYTHON_EXECUTABLE=... otherwise)") - execute_process( - COMMAND ${PYTHON_EXECUTABLE} -c "import tensorflow as tf; print(tf.__version__); print(tf.__cxx11_abi_flag__); print(tf.sysconfig.get_include()); print(tf.sysconfig.get_lib());" - OUTPUT_VARIABLE TF_INFORMATION_STRING - OUTPUT_STRIP_TRAILING_WHITESPACE - RESULT_VARIABLE retcode) - - if(NOT "${retcode}" STREQUAL "0") - message(FATAL_ERROR "Detecting TensorFlow info - failed \n Did you installed TensorFlow?") - else() - message(STATUS "Detecting TensorFlow info - done") - endif() - - string(REPLACE "\n" ";" TF_INFORMATION_LIST ${TF_INFORMATION_STRING}) - list(GET TF_INFORMATION_LIST 0 TF_DETECTED_VERSION) - list(GET TF_INFORMATION_LIST 1 TF_DETECTED_ABI) - list(GET TF_INFORMATION_LIST 2 TF_DETECTED_INCLUDE_DIR) - list(GET TF_INFORMATION_LIST 3 TF_DETECTED_LIBRARY_PATH) - - # set(TF_DETECTED_VERSION 1.8) - - set(_packageName "TF") - if (DEFINED TF_DETECTED_VERSION) - string (REGEX MATCHALL "[0-9]+" _versionComponents "${TF_DETECTED_VERSION}") - list (LENGTH _versionComponents _len) - if (${_len} GREATER 0) - list(GET _versionComponents 0 TF_DETECTED_VERSION_MAJOR) - endif() - if (${_len} GREATER 1) - list(GET _versionComponents 1 TF_DETECTED_VERSION_MINOR) - endif() - if (${_len} GREATER 2) - list(GET _versionComponents 2 TF_DETECTED_VERSION_PATCH) - endif() - if (${_len} GREATER 3) - list(GET _versionComponents 3 TF_DETECTED_VERSION_TWEAK) - endif() - set (TF_DETECTED_VERSION_COUNT ${_len}) - else() - set (TF_DETECTED_VERSION_COUNT 0) - endif() - - - # -- prevent pre 1.9 versions - # Note: TensorFlow 1.7 supported custom ops and all header files. - # TensorFlow 1.8 broke that promise and 1.9, 1.10 are fine again. - # This cmake-file is only tested against 1.9+. - if("${TF_DETECTED_VERSION}" VERSION_LESS "1.9") - message(FATAL_ERROR "Your installed TensorFlow version ${TF_DETECTED_VERSION} is too old.") - endif() - - if(TF_FIND_VERSION_EXACT) - # User requested exact match of TensorFlow. - # TensorFlow release cycles are currently just depending on (major, minor) - # But we test against both. - set(_TensorFlow_TEST_VERSIONS - "${TF_FIND_VERSION_MAJOR}.${TF_FIND_VERSION_MINOR}.${TF_FIND_VERSION_PATCH}" - "${TF_FIND_VERSION_MAJOR}.${TF_FIND_VERSION_MINOR}") - else() # TF_FIND_VERSION_EXACT - # User requested not an exact TensorFlow version. - # However, only TensorFlow versions 1.9, 1.10 support all header files - # for custom ops. - set(_TensorFlow_KNOWN_VERSIONS ${TensorFlow_ADDITIONAL_VERSIONS} - "1.9" "1.9.0" "1.10" "1.10.0" "1.11" "1.11.0" "1.12" "1.12.0" "1.13" "1.13.1" "1.14" ) - set(_TensorFlow_TEST_VERSIONS) - - if(TF_FIND_VERSION) - set(_TF_FIND_VERSION_SHORT "${TF_FIND_VERSION_MAJOR}.${TF_FIND_VERSION_MINOR}") - # Select acceptable versions. - foreach(version ${_TensorFlow_KNOWN_VERSIONS}) - if(NOT "${version}" VERSION_LESS "${TF_FIND_VERSION}") - # This version is high enough. - list(APPEND _TensorFlow_TEST_VERSIONS "${version}") - endif() - endforeach() - else() # TF_FIND_VERSION - # Any version is acceptable. - set(_TensorFlow_TEST_VERSIONS "${_TensorFlow_KNOWN_VERSIONS}") - endif() - endif() - - #### ---- Configure TensorFlow_SOURCE_DIR - # Order of precidence is 1) CMake variable value, 2) Environmental Variable value - if(IS_DIRECTORY "${TensorFlow_SOURCE_DIR}") - set(TensorFlow_SOURCE_DIR "${TensorFlow_SOURCE_DIR}" CACHE PATH "directory containing the file 'libtensorflow_cc${CMAKE_SHARED_LIBRARY_SUFFIX}'") - else() - if(IS_DIRECTORY "$ENV{TENSORFLOW_SOURCE_DIR}") - set(TensorFlow_SOURCE_DIR "$ENV{TENSORFLOW_SOURCE_DIR}" CACHE PATH "source code for tensorflow (i.e. the git checkout directory of the source code)") - else() - set(TensorFlow_SOURCE_DIR "TensorFlow_SOURCE_DIR-NOTFOUND" CACHE PATH "source code for tensorflow (i.e. the git checkout directory of the source code)") - endif() - endif() - - # Report on status of cmake cache variable for TensorFlow_SOURCE_DIR - if(IS_DIRECTORY ${TensorFlow_SOURCE_DIR}) - message(STATUS "TensorFlow_SOURCE_DIR is ${TensorFlow_SOURCE_DIR}") - else() - # NOTE This is not a fatal error for backward compatibility ("custom_op test") - message(STATUS "No directory at 'TensorFlow_SOURCE_DIR:PATH=${TensorFlow_SOURCE_DIR}' detected,\n" - "please specify the path in ENV 'export TENSORFLOW_SOURCE_DIR=...'\n or cmake -DTensorFlow_SOURCE_DIR:PATH=...\n" - "to the directory containing the source code for tensorflow\n (i.e. the git checkout directory of the source code)" - ) - endif() - - #### ---- Configure TensorFlow_BUILD_DIR - # Order of precidence is 1) CMake variable value, 2) Environmental Variable value - if(IS_DIRECTORY "${TensorFlow_BUILD_DIR}") - set(TensorFlow_BUILD_DIR "${TensorFlow_BUILD_DIR}" CACHE PATH "directory containing the file 'libtensorflow_cc${CMAKE_SHARED_LIBRARY_SUFFIX}'") - else() - if(IS_DIRECTORY "$ENV{TENSORFLOW_BUILD_DIR}") - set(TensorFlow_BUILD_DIR "$ENV{TENSORFLOW_BUILD_DIR}" CACHE PATH "directory containing the file 'libtensorflow_cc${CMAKE_SHARED_LIBRARY_SUFFIX}'") - else() - set(TensorFlow_BUILD_DIR "TensorFlow_BUILD_DIR-NOTFOUND" CACHE PATH "directory containing the file 'libtensorflow_cc${CMAKE_SHARED_LIBRARY_SUFFIX}'") - endif() - endif() - - # Report on status of cmake cache variable for TensorFlow_BUILD_DIR - if(IS_DIRECTORY ${TensorFlow_BUILD_DIR}) - message(STATUS "TensorFlow_BUILD_DIR is ${TensorFlow_BUILD_DIR}") - else() - # NOTE This is not a fatal error for backward compatibility ("custom_op test") - message(STATUS "No directory at 'TensorFlow_BUILD_DIR:PATH=${TensorFlow_BUILD_DIR}' detected,\n" - "please specify the path in ENV 'export TENSORFLOW_BUILD_DIR=...'\n or cmake -DTensorFlow_BUILD_DIR:PATH=...\n" - "to the directory containing the file 'libtensorflow_cc${CMAKE_SHARED_LIBRARY_SUFFIX}'" - ) - endif() - - if(IS_DIRECTORY ${TensorFlow_BUILD_DIR}) - file(GLOB_RECURSE TF_LIBRARY_SEARCH_PATHS - LIST_DIRECTORIES FALSE - "${TensorFlow_BUILD_DIR}/*libtensorflow_cc${CMAKE_SHARED_LIBRARY_SUFFIX}" - ) - list(LENGTH TF_LIBRARY_SEARCH_PATHS TF_LIBRARY_SEARCH_PATHS_LENGTH) - if( NOT ${TF_LIBRARY_SEARCH_PATHS_LENGTH} EQUAL 1 ) - message(FATAL_ERROR "Incorrect number of items matching 'libtensorflow_cc${CMAKE_SHARED_LIBRARY_SUFFIX}' in '${TF_LIBRARY_SEARCH_PATHS}'\n" - "( ${TF_LIBRARY_SEARCH_PATHS_LENGTH} != 1 ).\n" - "Change 'TensorFlow_BUILD_DIR' to have more specific path." - ) - endif() - list(GET TF_LIBRARY_SEARCH_PATHS 0 TF_LIBRARY_SEARCH_ONEPATH) - get_filename_component(TensorFlow_C_LIBRARY_DIR "${TF_LIBRARY_SEARCH_ONEPATH}" DIRECTORY ) - - if( IS_DIRECTORY "${TensorFlow_C_LIBRARY_DIR}") - find_library(TensorFlow_C_LIBRARY - NAMES tensorflow_cc - PATHS "${TensorFlow_C_LIBRARY_DIR}" - DOC "TensorFlow CC library." ) - endif() - if( TensorFlow_C_LIBRARY ) - message(STATUS "TensorFlow-CC-LIBRARY is ${TensorFlow_C_LIBRARY}") - else() - # NOTE This is not a fatal error for backward compatibility ("custom_op test") - message(STATUS "No TensorFlow-CC-LIBRARY detected") - endif() - endif() - - find_library( TF_DETECTED_LIBRARY - NAMES tensorflow_framework - PATHS "${TensorFlow_C_LIBRARY_DIR}" # Prefer the library from the build tree, if TensorFlow_C_LIBRARY is detected. - "${TF_DETECTED_LIBRARY_PATH}" # use copy of file from the python install tree (This often has a .so.1 extension only for installed version) - DOC "The tensorflow_framework library path." - ) - if( TF_DETECTED_LIBRARY ) - message(STATUS "Found: ${TF_DETECTED_LIBRARY}") - else() - message(FATAL_ERROR "Required library for tensorflow_framework not found in ${TF_DETECTED_LIBRARY_PATH}!") - endif() - - # test all given versions - set(TensorFlow_FOUND FALSE) - foreach(_TensorFlow_VER ${_TensorFlow_TEST_VERSIONS}) - if("${TF_DETECTED_VERSION_MAJOR}.${TF_DETECTED_VERSION_MINOR}" STREQUAL "${_TensorFlow_VER}") - # found appropriate version - set(TensorFlow_VERSION ${TF_DETECTED_VERSION}) - set(TensorFlow_ABI ${TF_DETECTED_ABI}) - set(TensorFlow_INCLUDE_DIR ${TF_DETECTED_INCLUDE_DIR}) - set(TensorFlow_LIBRARY ${TF_DETECTED_LIBRARY}) - set(TensorFlow_FOUND TRUE) - message(STATUS "Found TensorFlow: (found appropriate version \"${TensorFlow_VERSION}\")") - message(STATUS "TensorFlow-ABI is ${TensorFlow_ABI}") - message(STATUS "TensorFlow-INCLUDE_DIR is ${TensorFlow_INCLUDE_DIR}") - message(STATUS "TensorFlow-LIBRARY is ${TensorFlow_LIBRARY}") - - add_definitions("-DTENSORFLOW_ABI=${TensorFlow_ABI}") - add_definitions("-DTENSORFLOW_VERSION=${TensorFlow_VERSION}") - break() - endif() - endforeach() - - if(NOT TensorFlow_FOUND) - message(FATAL_ERROR "Your installed TensorFlow version ${TF_DETECTED_VERSION_MAJOR}.${TF_DETECTED_VERSION_MINOR} is not supported\n" - "We tested against ${_TensorFlow_TEST_VERSIONS}") - endif() - - # test 1.11 version - if("${TF_DETECTED_VERSION}" VERSION_EQUAL "1.11") - set(TF_DISABLE_ASSERTS "TRUE") - endif() - - if("${TF_DETECTED_VERSION}" VERSION_EQUAL "1.12") - set(TF_DISABLE_ASSERTS "TRUE") - endif() - - if("${TF_DETECTED_VERSION}" VERSION_EQUAL "1.12.0") - set(TF_DISABLE_ASSERTS "TRUE") - endif() - - if("${TF_DETECTED_VERSION}" VERSION_EQUAL "1.13") - set(TF_DISABLE_ASSERTS "TRUE") - endif() - - if("${TF_DETECTED_VERSION}" VERSION_EQUAL "1.13.1") - set(TF_DISABLE_ASSERTS "TRUE") - endif() - -endif() #-- End detection - -if(${TF_DISABLE_ASSERTS}) - message(STATUS "[WARNING] The TensorFlow version ${TF_DETECTED_VERSION} has a bug (see \#22766). We disable asserts using -DNDEBUG=True ") - add_definitions("-DNDEBUG=True") -endif() -macro(TensorFlow_REQUIRE_C_LIBRARY) - if(NOT EXISTS "${TensorFlow_C_LIBRARY}") - message(FATAL_ERROR "Project requires libtensorflow_cc${CMAKE_SHARED_LIBRARY_SUFFIX}, please specify the path in ENV 'export TENSORFLOW_BUILD_DIR=...' or cmake -DTensorFlow_BUILD_DIR:PATH=...") - endif() -endmacro() - -macro(TensorFlow_REQUIRE_SOURCE) - if(NOT IS_DIRECTORY "${TensorFlow_SOURCE_DIR}") - message(FATAL_ERROR "Project requires TensorFlow source directory, please specify the path in ENV 'export TENSORFLOW_SOURCE_DIR=...' or cmake -DTensorFlow_SOURCE_DIR:PATH=...") - endif() -endmacro() - -macro(add_tensorflow_cpu_operation op_name) - # Compiles a CPU-only operation without invoking NVCC - message(STATUS "will build custom TensorFlow operation \"${op_name}\" (CPU only)") - - add_library(${op_name}_op SHARED kernels/${op_name}_op.cc kernels/${op_name}_kernel.cc ops/${op_name}.cc ) - - set_target_properties(${op_name}_op PROPERTIES PREFIX "") - target_link_libraries(${op_name}_op LINK_PUBLIC ${TensorFlow_LIBRARY}) -endmacro() - - -macro(add_tensorflow_gpu_operation op_name) -# Compiles a CPU + GPU operation with invoking NVCC - message(STATUS "will build custom TensorFlow operation \"${op_name}\" (CPU+GPU)") - - set(kernel_file "") - if(EXISTS "kernels/${op_name}_kernel.cu") - message(WARNING "you should rename your file ${op_name}_kernel.cu to ${op_name}_kernel_gpu.cu.cc") - set(kernel_file kernels/${op_name}_kernel.cu) - else() - set_source_files_properties(kernels/${op_name}_kernel_gpu.cu.cc PROPERTIES CUDA_SOURCE_PROPERTY_FORMAT OBJ) - set(kernel_file kernels/${op_name}_kernel_gpu.cu.cc) - endif() - - cuda_add_library(${op_name}_op_cu SHARED ${kernel_file}) - set_target_properties(${op_name}_op_cu PROPERTIES PREFIX "") - - add_library(${op_name}_op SHARED kernels/${op_name}_op.cc kernels/${op_name}_kernel.cc ops/${op_name}.cc ) - - set_target_properties(${op_name}_op PROPERTIES PREFIX "") - set_target_properties(${op_name}_op PROPERTIES COMPILE_FLAGS "-DGOOGLE_CUDA") - target_link_libraries(${op_name}_op LINK_PUBLIC ${op_name}_op_cu ${TensorFlow_LIBRARY}) -endmacro() - -# simplify TensorFlow dependencies -add_library(TensorFlow_DEP INTERFACE) -target_include_directories(TensorFlow_DEP SYSTEM INTERFACE ${TensorFlow_SOURCE_DIR}) -target_include_directories(TensorFlow_DEP SYSTEM INTERFACE ${TensorFlow_INCLUDE_DIR}) -target_link_libraries(TensorFlow_DEP INTERFACE -Wl,--allow-multiple-definition -Wl,--whole-archive ${TensorFlow_C_LIBRARY} -Wl,--no-whole-archive) -target_link_libraries(TensorFlow_DEP INTERFACE -Wl,--allow-multiple-definition -Wl,--whole-archive ${TensorFlow_LIBRARY} -Wl,--no-whole-archive) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args( - TENSORFLOW - FOUND_VAR TENSORFLOW_FOUND - REQUIRED_VARS - TensorFlow_LIBRARY - TensorFlow_INCLUDE_DIR - VERSION_VAR - TensorFlow_VERSION - ) - -mark_as_advanced(TF_INFORMATION_STRING TF_DETECTED_VERSION TF_DETECTED_VERSION_MAJOR TF_DETECTED_VERSION_MINOR TF_DETECTED_VERSION TF_DETECTED_ABI - TF_DETECTED_INCLUDE_DIR TF_DETECTED_LIBRARY TF_DISABLE_ASSERTS - TensorFlow_C_LIBRARY TensorFlow_LIBRARY TensorFlow_SOURCE_DIR TensorFlow_INCLUDE_DIR TensorFlow_ABI) - -set(TensorFlow_INCLUDE_DIR "${TensorFlow_INCLUDE_DIR}" CACHE PATH "The path to tensorflow header files") -set(TensorFlow_VERSION "${TensorFlow_VERSION}" CACHE INTERNAL "The Tensorflow version") -set(TensorFlow_ABI "${TensorFlow_ABI}" CACHE STRING "The ABI version used by TensorFlow") -set(TensorFlow_LIBRARY "${TensorFlow_LIBRARY}" CACHE FILEPATH "The C++ library of TensorFlow") -set(TensorFlow_C_LIBRARY "${TensorFlow_C_LIBRARY}" CACHE STRING "The C library of TensorFlow") -set(TensorFlow_FOUND "${TensorFlow_FOUND}" CACHE BOOL "A flag stating if TensorFlow has been found") -set(TF_DISABLE_ASSERTS "${TF_DISABLE_ASSERTS}" CACHE BOOL "A flag to enable workarounds") From eb1158c7013e0f8a489a44a0b1517c03dfff6305 Mon Sep 17 00:00:00 2001 From: alon Date: Tue, 12 Oct 2021 18:03:29 +0300 Subject: [PATCH 42/45] Remove unused build logic, update documentation --- docs/developer-backends.md | 17 +++---- docs/developer.md | 11 ++++- get_deps.sh | 24 +++++----- opt/build/libtorch/repack.sh | 92 ------------------------------------ 4 files changed, 28 insertions(+), 116 deletions(-) delete mode 100755 opt/build/libtorch/repack.sh diff --git a/docs/developer-backends.md b/docs/developer-backends.md index 5d7411f80..55eb936b9 100644 --- a/docs/developer-backends.md +++ b/docs/developer-backends.md @@ -1,14 +1,17 @@ # RedisAI Development Backends -This document describes how a backend for RedisAI can be built, from this repository. It highlights the supported compilation devices on a per-backend basis, and highlights the tools and commands required. Unless indicated otherwise, a backend is compiled in a docker, which is responsible for the configuration and installation of all tools required for a given backend on a per-platform basis. +This document describes how ONNXRuntime backend can be built from this repository. +We build ONNXRuntime library with DISABLE_EXTERNAL_INITIALIZERS=ON build flag, which is not the default configuration. This means that loading ONNX models that use external files to store the initial (usually very large) values of the model's operations, is invalid. That is, initializers values must be part of the serialized model, which is also the standard use case. + +It is compiled in a docker, which is responsible for the configuration and installation of all tools required the build process. To follow these instructions, this repository must be cloned with all of its submodules (i.e *git clone --recursive https://github.com/redisai/redisai*) -GNU Make is used as a runner for the dockerfile generator. Python is the language used for the generator script, and jinja is the templating library used to create the docker file from a template *dockerfile.tmpl* that can be found in the directory of a given backend listed below. +GNU Make is used as a runner for the dockerfile generator. Python is the language used for the generator script, and jinja is the templating library used to create the docker file from a template *dockerfile.tmpl* that can be found in the `/opt/build/onnxruntime` directory. -## Tools +### Tools -Building the backends requires installation of the following tools: +Building the backend requires installation of the following tools: 1. gnu make 1. python (3.0 or higher) @@ -26,12 +29,6 @@ pip install jinja ------- -## Backends - -### onnxruntime - -We build Onnxruntime library with DISABLE_EXTERNAL_INITIALIZERS=ON build flag. This means that loading ONNX models that use external files to store the initial (usually very large) values of the model's operations, is invalid. That is, initializers values must be part of the serialized model, which is also the standard use case. - **Compilation target devices:** 1. x86\_64 bit linux systems diff --git a/docs/developer.md b/docs/developer.md index 6e1f8f2df..1868284a7 100644 --- a/docs/developer.md +++ b/docs/developer.md @@ -170,9 +170,16 @@ sudo ./opt/system-setup.py **Building** -To compile RedisAI, run *make -C opt all*, from the root of the repository. +Before compiling RedisAI module, make sure that you have the backends' shared libraries in the `deps` directory. These can be easily obtained by running: +```./get_deps``` +or +```./get_deps gpu``` +for having GPU support. +Except for ONNXRuntime backend which is stored in a S3 bucket, other backends' binary files are downloaded directly from their official websites. +Further details about building ONNXRuntime backend for RedisAI is described in [this document](developer-backends.md). + +To compile RedisAI, run `make -C opt` or `make -C opt GPU=1`, from the root of the repository. This will create the module's shared library `redisai.so` in `instali-cpu`/`install-gpu` directory respectively. -Build the backends is described in [this document](developer-backends.md). ### Testing diff --git a/get_deps.sh b/get_deps.sh index 87cf1f661..2263a4a79 100755 --- a/get_deps.sh +++ b/get_deps.sh @@ -29,9 +29,9 @@ if [[ $1 == --help || $1 == help ]]; then VERBOSE=1 Print commands FORCE=1 Download even if present WITH_DLPACK=0 Skip dlpack - WITH_TF=0 Skip Tensorflow or download from S3 repo - WITH_TFLITE=0 Skip TensorflowLite or download from S3 repo - WITH_PT=0 Skip PyTorch or download from S3 repo + WITH_TF=0 Skip Tensorflow or download official version + WITH_TFLITE=0 Skip TensorflowLite or download official version + WITH_PT=0 Skip PyTorch or download official version WITH_ORT=0 Skip OnnxRuntime or download from S3 repo OS= Set, to override the platform OS ARCH=0 Set, to override the platform ARCH @@ -99,17 +99,17 @@ clean_and_fetch() { echo "Done." } -# This is fot torch backend, which comes in a zip file +# This is foר torch backend, which comes in a zip file clean_and_fetch_torch() { archive=$1 src_url=$2 - [[ $FORCE == 1 ]] && rm -rf ${product} # FORCE is from the env - [[ $FORCE != 1 ]] && [[ -d ${product} ]] && echo "${product} is in place, skipping. Set FORCE=1 to override. Continuing." && return - echo "Installing ${product} from ${src_url} in `pwd`..." - - wget -q -O archive src_url - + [[ $FORCE == 1 ]] && rm -rf libtorch # FORCE is from the env + [[ $FORCE != 1 ]] && [[ -d libtorch ]] && echo "libtorch is in place, skipping. Set FORCE=1 to override. Continuing." && return + echo "Installing libtorch from ${src_url} in `pwd`..." + LIBTORCH_ZIP=libtorch-${DEVICE}-${PT_VERSION}.zip + wget -q -O ${LIBTORCH_ZIP} ${src_url} + unzip -q -o ${LIBTORCH_ZIP} } @@ -181,14 +181,13 @@ fi # WITH_TFLITE ####################################################################################### LIBTORCH PT_BUILD=cpu -PT_ARCH=x86_64 if [[ $OS == linux ]]; then PT_OS=linux if [[ $GPU == 1 ]]; then PT_BUILD=cu111 fi if [[ $ARCH == x64 ]]; then - PT_REPACK=1 + PT_ARCH=x86_64 else echo "Only x64 is supported currently" fi @@ -225,6 +224,7 @@ if [[ $OS == linux ]]; then fi else echo "Only Linux OS is supported currently" +fi ORT_ARCHIVE=onnxruntime-${ORT_OS}-${ORT_ARCH}${ORT_BUILD}-${ORT_VERSION}.tgz if [[ $WITH_ORT != 0 ]]; then diff --git a/opt/build/libtorch/repack.sh b/opt/build/libtorch/repack.sh deleted file mode 100755 index d4d8be860..000000000 --- a/opt/build/libtorch/repack.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env bash - -set -e -[[ $VERBOSE == 1 ]] && set -x - -HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" - -ROOT=$HERE/../../.. -#. $ROOT/opt/readies/shibumi/functions -ROOT=$(realpath $ROOT) - -if [[ "$1" == "cpu" || $CPU == 1 ]]; then - GPU=0 - DEVICE=cpu -elif [[ "$1" == "gpu" || $GPU == 1 ]]; then - GPU=1 - DEVICE=gpu -else - GPU=${GPU:-0} - if [[ $GPU == 1 ]]; then - DEVICE=gpu - else - DEVICE=cpu - fi -fi - -# set them internally or externally -if [ -z ${OS} ]; then - OS=$(python3 $ROOT/opt/readies/bin/platform --os) -fi -if [ -z ${ARCH} ]; then - ARCH=$(python3 $ROOT/opt/readies/bin/platform --arch) -fi - -TARGET_DIR=$ROOT/deps/$OS-$ARCH-$DEVICE - -# avoid wget warnings on macOS -[[ $OS == macos ]] && export LC_ALL=en_US.UTF-8 - -if [[ -z $PT_VERSION ]]; then - PT_VERSION="latest" -fi - -if [[ $OS == linux ]]; then - PT_OS=shared-with-deps - if [[ $GPU != 1 ]]; then - PT_BUILD=cpu - else - PT_BUILD=cu111 - fi - if [[ $ARCH == x64 ]]; then - PT_ARCH=x86_64 - fi -elif [[ $OS == macos ]]; then - PT_OS=macos - PT_ARCH=x86_64 - PT_BUILD=cpu -fi - -[[ "$PT_VERSION" == "latest" ]] && PT_BUILD=nightly/${PT_BUILD} - -if [[ $OS == linux ]]; then - if [[ $PT_VERSION == 1.2.0 ]]; then - LIBTORCH_ARCHIVE=libtorch-${PT_OS}-${PT_VERSION}.zip - elif [[ $PT_VERSION == latest ]]; then - LIBTORCH_ARCHIVE=libtorch-shared-with-deps-latest.zip - else - if [[ $GPU != 1 ]]; then - LIBTORCH_ARCHIVE=libtorch-cxx11-abi-shared-with-deps-${PT_VERSION}%2B${PT_BUILD}.zip - else - LIBTORCH_ARCHIVE=libtorch-cxx11-abi-shared-with-deps-${PT_VERSION}%2B${PT_BUILD}.zip - fi - fi - - -[[ -z $LIBTORCH_URL ]] && LIBTORCH_URL=https://download.pytorch.org/libtorch/$PT_BUILD/$LIBTORCH_ARCHIVE - -LIBTORCH_ZIP=libtorch-${PT_BUILD}-${PT_OS}-${PT_ARCH}-${PT_VERSION}.zip -if [ ! -f $LIBTORCH_ARCHIVE ]; then - echo "Downloading libtorch ${PT_VERSION} ${PT_BUILD}" - wget -q -O $LIBTORCH_ZIP $LIBTORCH_URL -fi - -if [[ $OS == linux ]]; then - PT_OS=linux -fi - -unzip -q -o $LIBTORCH_ZIP -dest=$TARGET_DIR/libtorch-${PT_BUILD}-${PT_OS}-${PT_ARCH}-${PT_VERSION}.tar.gz -mkdir -p $(dirname $dest) -tar czf $dest libtorch/ -rm -rf libtorch/ $LIBTORCH_ZIP From 8251a416f63a700b08d406cf0d26421fc355f178 Mon Sep 17 00:00:00 2001 From: alon Date: Tue, 12 Oct 2021 18:08:37 +0300 Subject: [PATCH 43/45] Increase timeout in test for valgrind --- tests/flow/tests_pytorch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/flow/tests_pytorch.py b/tests/flow/tests_pytorch.py index e4052b0ad..40856660a 100644 --- a/tests/flow/tests_pytorch.py +++ b/tests/flow/tests_pytorch.py @@ -413,7 +413,7 @@ def run(): # make sure that we have a long operation that RedisAI will run upon sending the following # command, to assure that timeout will occur. - time.sleep(0.1) + time.sleep(0.5) ret = con.execute_command('AI.SCRIPTEXECUTE', 'my_script{$}', 'bar', 'INPUTS', 2, 'a{$}', 'b{$}', 'OUTPUTS', 1, 'c{$}', 'TIMEOUT', 1) env.assertEqual(ret, b'TIMEDOUT') From e0324e7cb315ec3403d3ed0fba3b03289fea27e2 Mon Sep 17 00:00:00 2001 From: alon Date: Wed, 13 Oct 2021 09:37:35 +0300 Subject: [PATCH 44/45] minor fix --- get_deps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/get_deps.sh b/get_deps.sh index 2263a4a79..c50a8fbbd 100755 --- a/get_deps.sh +++ b/get_deps.sh @@ -99,7 +99,7 @@ clean_and_fetch() { echo "Done." } -# This is foר torch backend, which comes in a zip file +# This is for torch backend, which comes in a zip file clean_and_fetch_torch() { archive=$1 src_url=$2 From 3a178576cdb1823d488e7269a4d80bb9a7b48336 Mon Sep 17 00:00:00 2001 From: alon Date: Wed, 13 Oct 2021 10:28:23 +0300 Subject: [PATCH 45/45] Rephrasing docs --- docs/developer-backends.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/developer-backends.md b/docs/developer-backends.md index 55eb936b9..d1dae51a5 100644 --- a/docs/developer-backends.md +++ b/docs/developer-backends.md @@ -1,13 +1,13 @@ # RedisAI Development Backends This document describes how ONNXRuntime backend can be built from this repository. -We build ONNXRuntime library with DISABLE_EXTERNAL_INITIALIZERS=ON build flag, which is not the default configuration. This means that loading ONNX models that use external files to store the initial (usually very large) values of the model's operations, is invalid. That is, initializers values must be part of the serialized model, which is also the standard use case. +We build the ONNXRuntime library with the DISABLE_EXTERNAL_INITIALIZERS=ON build flag. As a result, loading ONNX models that use external files to store the initial (usually very large) values of the model's operations, is invalid. Hence, initialization values must be part of the serialized model, which is also the standard use case. It is compiled in a docker, which is responsible for the configuration and installation of all tools required the build process. To follow these instructions, this repository must be cloned with all of its submodules (i.e *git clone --recursive https://github.com/redisai/redisai*) -GNU Make is used as a runner for the dockerfile generator. Python is the language used for the generator script, and jinja is the templating library used to create the docker file from a template *dockerfile.tmpl* that can be found in the `/opt/build/onnxruntime` directory. +GNU Make is used as a runner for the dockerfile generator. Python is the language used for the generator script, and jinja is the templating library used to create the docker file from the template *dockerfile.tmpl*, located in the `/opt/build/onnxruntime` directory. ### Tools @@ -24,7 +24,7 @@ On ubuntu bionic these can be installed by running the following steps, to insta sudo apt install python3 python3-dev make docker python3 -m venv /path/to/venv source /path/to/venv/bin/activate -pip install jinja +pip install jinja2 ``` -------