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/31] 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/31] 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/31] 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/31] 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/31] 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/31] 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 fffa1ea7f485a47fa1ec8f62e14898326e40ad53 Mon Sep 17 00:00:00 2001 From: "Chayim I. Kirshen" Date: Thu, 17 Jun 2021 12:55:57 +0300 Subject: [PATCH 07/31] 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 08/31] 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 d3310f54db873de291aed9e4395fdc2c4e75dcc0 Mon Sep 17 00:00:00 2001 From: alon Date: Wed, 4 Aug 2021 17:04:10 +0300 Subject: [PATCH 09/31] wrap the new onnxruntime custom allocator API instead of using the forked onnx allocator api --- CMakeLists.txt | 2 + src/backends/onnx_allocator/CMakeLists.txt | 3 + .../onnx_allocator/onnx_allocator.cpp | 113 ++++++++++++++++++ src/backends/onnx_allocator/onnx_allocator.h | 17 +++ src/backends/onnxruntime.c | 62 +--------- src/backends/onnxruntime.h | 4 - src/util/arr.h | 6 +- 7 files changed, 141 insertions(+), 66 deletions(-) create mode 100644 src/backends/onnx_allocator/CMakeLists.txt create mode 100644 src/backends/onnx_allocator/onnx_allocator.cpp create mode 100644 src/backends/onnx_allocator/onnx_allocator.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 632e5c8d6..88510e119 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -160,6 +160,7 @@ ENDIF() IF(BUILD_ORT) FIND_LIBRARY(ORT_LIBRARIES NAMES onnxruntime PATHS ${depsAbs}/onnxruntime/lib) + ADD_SUBDIRECTORY(src/backends/onnx_allocator) MESSAGE(STATUS "Found ONNXRuntime Libraries: \"${ORT_LIBRARIES}\")") IF (NOT ORT_LIBRARIES) MESSAGE(FATAL_ERROR "Could not find ONNXRuntime") @@ -293,6 +294,7 @@ ENDIF() IF(BUILD_ORT) ADD_LIBRARY(redisai_onnxruntime SHARED $) + TARGET_LINK_LIBRARIES(redisai_onnxruntime onnx_allocator ${ORT_LIBRARIES}) TARGET_LINK_LIBRARIES(redisai_onnxruntime ${ORT_LIBRARIES}) SET_TARGET_PROPERTIES(redisai_onnxruntime PROPERTIES PREFIX "") SET_TARGET_PROPERTIES(redisai_onnxruntime PROPERTIES SUFFIX ".so") diff --git a/src/backends/onnx_allocator/CMakeLists.txt b/src/backends/onnx_allocator/CMakeLists.txt new file mode 100644 index 000000000..89503fe4d --- /dev/null +++ b/src/backends/onnx_allocator/CMakeLists.txt @@ -0,0 +1,3 @@ +add_library(onnx_allocator STATIC onnx_allocator.cpp) +target_link_libraries(onnx_allocator "${ONNX_LIBRARIES}") +set_property(TARGET onnx_allocator PROPERTY CXX_STANDARD 14) \ No newline at end of file diff --git a/src/backends/onnx_allocator/onnx_allocator.cpp b/src/backends/onnx_allocator/onnx_allocator.cpp new file mode 100644 index 000000000..add916838 --- /dev/null +++ b/src/backends/onnx_allocator/onnx_allocator.cpp @@ -0,0 +1,113 @@ +#include "onnx_allocator.h" +#include "../onnxruntime.h" +#include "onnxruntime_cxx_api.h" +#include + +struct RAIOrtAllocator : OrtAllocator { + RAIOrtAllocator(); + ~RAIOrtAllocator(); + + void* Alloc(size_t size); + void Free(void* p); + const OrtMemoryInfo* Info() const; + unsigned long long NumAllocatorAccess() const; + unsigned long long MemoryInUse() const; + void SetMemoryLimit(unsigned long long max_memory); + static RAIOrtAllocator *GetInstance(); + +private: + RAIOrtAllocator(const RAIOrtAllocator&) = delete; + RAIOrtAllocator& operator=(const RAIOrtAllocator&) = delete; + + std::atomic memory_inuse{0}; + std::atomic num_allocator_access{0}; + unsigned long long memory_limit = 0; + OrtMemoryInfo* cpu_memory_info; + static RAIOrtAllocator* allocator_instance; +}; + +RAIOrtAllocator* RAIOrtAllocator::allocator_instance = nullptr; + +RAIOrtAllocator::RAIOrtAllocator() { + OrtAllocator::version = ORT_API_VERSION; + OrtAllocator::Alloc = [](OrtAllocator* this_, size_t size) { return static_cast(this_)->Alloc(size); }; + OrtAllocator::Free = [](OrtAllocator* this_, void* p) { static_cast(this_)->Free(p); }; + OrtAllocator::Info = [](const OrtAllocator* this_) { return static_cast(this_)->Info(); }; + Ort::ThrowOnError(Ort::GetApi().CreateCpuMemoryInfo(OrtDeviceAllocator, OrtMemTypeDefault, &cpu_memory_info)); + RAIOrtAllocator::allocator_instance = this; +} + +RAIOrtAllocator::~RAIOrtAllocator() { + Ort::GetApi().ReleaseMemoryInfo(cpu_memory_info); +} + +void* RAIOrtAllocator::Alloc(size_t size) { + // Allocate an additional 63 bytes to ensure that we can return an address which is + // 64-byte aligned, and an additional space in the size of a pointer to store + // the address that RedisModule_Alloc returns. + int offset = 63 + sizeof(void *); + void *allocated_address = (void *)RedisModule_Alloc(size + offset); + size_t allocated_size = RedisModule_MallocSize(allocated_address); + // Update the total number of bytes that onnx is using and the number of accesses + // that onnx made to the allocator. + size_t cur_memory = memory_inuse.load(); + if (cur_memory + allocated_size > memory_limit) { + throw Ort::Exception("Onnxruntime memory limit exceeded, memory allocation failed.", ORT_RUNTIME_EXCEPTION); + } + memory_inuse.fetch_add(allocated_size); + num_allocator_access.fetch_add(1); + // This operation guarantees that p2 is the closest 64-aligned address to (p1+size_t). + void **aligned_address = (void **)(((size_t)(allocated_address) + offset) & (~63)); + // This stores the address p1 right before p2 (so we can retrieve it when we free). + aligned_address[-1] = allocated_address; + return aligned_address; +} + +void RAIOrtAllocator::Free(void* p) { + if (p == NULL) { + return; + } + // Retrieve the address that we originally received from RedisModule_Alloc + // (this is the address that we need to sent to RedisModule_Free). + void *allocated_address = ((void **)p)[-1]; + size_t allocated_size = RedisModule_MallocSize(allocated_address); + // Update the total number of bytes that onnx is using and the number of accesses + // that onnx made to the allocator. + memory_inuse.fetch_sub(allocated_size); + num_allocator_access.fetch_add(1); + RedisModule_Free(allocated_address); +} + +const OrtMemoryInfo* RAIOrtAllocator::Info() const { + return cpu_memory_info; +} + +unsigned long long RAIOrtAllocator::NumAllocatorAccess() const { + return num_allocator_access.load(); +} + +unsigned long long RAIOrtAllocator::MemoryInUse() const { + return memory_inuse.load(); +} + +void RAIOrtAllocator::SetMemoryLimit(unsigned long long max_memory) { + memory_limit = max_memory; +} + +RAIOrtAllocator *RAIOrtAllocator::GetInstance() { + return RAIOrtAllocator::allocator_instance; +} + +OrtAllocator *CreateCustomAllocator(unsigned long long max_memory) { + auto *allocator = new RAIOrtAllocator(); + allocator->SetMemoryLimit(max_memory); + return allocator; +} + +unsigned long long RAI_GetMemoryInfoORT() { + return RAIOrtAllocator::GetInstance()->MemoryInUse(); +} + +unsigned long long RAI_GetMemoryAccessORT() { + return RAIOrtAllocator::GetInstance()->NumAllocatorAccess(); +} diff --git a/src/backends/onnx_allocator/onnx_allocator.h b/src/backends/onnx_allocator/onnx_allocator.h new file mode 100644 index 000000000..f7db13af1 --- /dev/null +++ b/src/backends/onnx_allocator/onnx_allocator.h @@ -0,0 +1,17 @@ +#pragma once + +#include "onnxruntime_c_api.h" + +#ifdef __cplusplus +extern "C" { +#endif + +OrtAllocator *CreateCustomAllocator(unsigned long long max_memory); + +unsigned long long RAI_GetMemoryInfoORT(); + +unsigned long long RAI_GetMemoryAccessORT(); + +#ifdef __cplusplus +} +#endif diff --git a/src/backends/onnxruntime.c b/src/backends/onnxruntime.c index aee7a42d6..fda0ce087 100644 --- a/src/backends/onnxruntime.c +++ b/src/backends/onnxruntime.c @@ -7,6 +7,7 @@ #include "util/arr.h" #include "backends/onnxruntime.h" #include "redis_ai_objects/tensor.h" +#include "onnx_allocator/onnx_allocator.h" #include "onnxruntime_c_api.h" #include "backends_api.h" @@ -22,63 +23,7 @@ OrtEnv *env = NULL; // For model that run on GPU, onnx will not use the custom allocator (redis allocator), but // the onnx allocator for GPU. But for the auxiliary allocations of the input and output names, // we will use the custom global allocator for models that run on GPU as well. -OrtMemoryInfo *mem_info = NULL; OrtAllocator *global_allocator = NULL; -unsigned long long OnnxMemory = 0; -unsigned long long OnnxMemoryAccessCounter = 0; - -const OrtMemoryInfo *AllocatorInfo(const OrtAllocator *allocator) { - (void)allocator; - const OrtApi *ort = OrtGetApiBase()->GetApi(1); - if (mem_info != NULL) { - return mem_info; - } - if (ort->CreateCpuMemoryInfo(OrtDeviceAllocator, OrtMemTypeDefault, &mem_info) != NULL) { - return NULL; - } - return mem_info; -} - -// Allocate address with 64-byte alignment to cope with onnx optimizations. -void *AllocatorAlloc(OrtAllocator *ptr, size_t size) { - - (void)ptr; - // Allocate an additional 63 bytes to ensure that we can return an address which is - // 64-byte aligned, and an additional space in the size of a pointer to store - // the address that RedisModule_Alloc returns. - int offset = 63 + sizeof(void *); - void *allocated_address = (void *)RedisModule_Alloc(size + offset); - size_t allocated_size = RedisModule_MallocSize(allocated_address); - // Update the total number of bytes that onnx is using and the number of accesses - // that onnx made to the allocator. - atomic_fetch_add(&OnnxMemory, allocated_size); - atomic_fetch_add(&OnnxMemoryAccessCounter, 1); - // This operation guarantees that p2 is the closest 64-aligned address to (p1+size_t). - void **aligned_address = (void **)(((size_t)(allocated_address) + offset) & (~63)); - // This stores the address p1 right before p2 (so we can retrieve it when we free). - aligned_address[-1] = allocated_address; - return aligned_address; -} - -void AllocatorFree(OrtAllocator *ptr, void *aligned_address) { - (void)ptr; - if (aligned_address == NULL) { - return; - } - // Retrieve the address that we originally received from RedisModule_Alloc - // (this is the address that we need to sent to RedisModule_Free). - void *allocated_address = ((void **)aligned_address)[-1]; - size_t allocated_size = RedisModule_MallocSize(allocated_address); - // Update the total number of bytes that onnx is using and the number of accesses - // that onnx made to the allocator. - atomic_fetch_sub(&OnnxMemory, allocated_size); - atomic_fetch_add(&OnnxMemoryAccessCounter, 1); - return RedisModule_Free(allocated_address); -} - -unsigned long long RAI_GetMemoryInfoORT() { return OnnxMemory; } - -unsigned long long RAI_GetMemoryAccessORT() { return OnnxMemoryAccessCounter; } int RAI_InitBackendORT(int (*get_api_fn)(const char *, void **)) { // Export redis callbacks. @@ -371,9 +316,8 @@ 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)) + global_allocator = CreateCustomAllocator(1000); + ONNX_VALIDATE_STATUS(ort->RegisterAllocator(env, global_allocator)) } ONNX_VALIDATE_STATUS(ort->CreateSessionOptions(&session_options)) diff --git a/src/backends/onnxruntime.h b/src/backends/onnxruntime.h index d165af32c..36db1b380 100644 --- a/src/backends/onnxruntime.h +++ b/src/backends/onnxruntime.h @@ -5,10 +5,6 @@ #include "redis_ai_objects/model.h" #include "execution/execution_contexts/execution_ctx.h" -unsigned long long RAI_GetMemoryInfoORT(void); - -unsigned long long RAI_GetMemoryAccessORT(void); - int RAI_InitBackendORT(int (*get_api_fn)(const char *, void **)); RAI_Model *RAI_ModelCreateORT(RAI_Backend backend, const char *devicestr, RAI_ModelOpts opts, diff --git a/src/util/arr.h b/src/util/arr.h index fd4427189..788cdf510 100644 --- a/src/util/arr.h +++ b/src/util/arr.h @@ -58,7 +58,7 @@ typedef void *array_t; /* Initialize a new array with a given element size and capacity. Should not be used directly - use * array_new instead */ static array_t array_new_sz(uint32_t elem_sz, uint32_t cap, uint32_t len) { - array_hdr_t *hdr = array_alloc_fn(sizeof(array_hdr_t) + cap * elem_sz); + array_hdr_t *hdr = (array_hdr_t *)array_alloc_fn(sizeof(array_hdr_t) + cap * elem_sz); hdr->on_stack = false; hdr->cap = cap; hdr->elem_sz = elem_sz; @@ -116,7 +116,7 @@ static inline array_t array_ensure_cap(array_t arr, uint32_t cap) { } if (cap > hdr->cap) { hdr->cap = MAX(hdr->cap * 2, cap); - hdr = array_realloc_fn(hdr, array_sizeof(hdr)); + hdr = (array_hdr_t *)array_realloc_fn(hdr, array_sizeof(hdr)); } return (array_t)hdr->buf; } @@ -150,7 +150,7 @@ static inline void *array_trimm(array_t arr, uint32_t len, uint32_t cap) { if (cap != -1) { arr_hdr->cap = cap; if (!arr_hdr->on_stack) - arr_hdr = array_realloc_fn(arr_hdr, array_sizeof(arr_hdr)); + arr_hdr = (array_hdr_t *)array_realloc_fn(arr_hdr, array_sizeof(arr_hdr)); } return arr_hdr->buf; } From 6283f3a9411ba34e2e1edf6b5f206893035756f5 Mon Sep 17 00:00:00 2001 From: alon Date: Tue, 24 Aug 2021 10:20:30 +0300 Subject: [PATCH 10/31] compare between allocators --- src/backends/onnxruntime.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/backends/onnxruntime.c b/src/backends/onnxruntime.c index fda0ce087..ad7a27bd6 100644 --- a/src/backends/onnxruntime.c +++ b/src/backends/onnxruntime.c @@ -316,8 +316,9 @@ 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)) - global_allocator = CreateCustomAllocator(1000); - ONNX_VALIDATE_STATUS(ort->RegisterAllocator(env, global_allocator)) + //global_allocator = CreateCustomAllocator(1000000); + //ONNX_VALIDATE_STATUS(ort->RegisterAllocator(env, global_allocator)) + ONNX_VALIDATE_STATUS(ort->GetAllocatorWithDefaultOptions(&global_allocator)) } ONNX_VALIDATE_STATUS(ort->CreateSessionOptions(&session_options)) From 825f4e09cddc96e8ee4b075069321c6432fb7d84 Mon Sep 17 00:00:00 2001 From: alon Date: Tue, 31 Aug 2021 15:21:32 +0300 Subject: [PATCH 11/31] log onnx max memory --- src/backends/onnx_allocator/onnx_allocator.cpp | 5 +++++ src/backends/onnxruntime.c | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/backends/onnx_allocator/onnx_allocator.cpp b/src/backends/onnx_allocator/onnx_allocator.cpp index add916838..ebd45af65 100644 --- a/src/backends/onnx_allocator/onnx_allocator.cpp +++ b/src/backends/onnx_allocator/onnx_allocator.cpp @@ -21,6 +21,7 @@ struct RAIOrtAllocator : OrtAllocator { std::atomic memory_inuse{0}; std::atomic num_allocator_access{0}; + std::atomic max_memory_in_use{0}; unsigned long long memory_limit = 0; OrtMemoryInfo* cpu_memory_info; static RAIOrtAllocator* allocator_instance; @@ -55,6 +56,10 @@ void* RAIOrtAllocator::Alloc(size_t size) { throw Ort::Exception("Onnxruntime memory limit exceeded, memory allocation failed.", ORT_RUNTIME_EXCEPTION); } memory_inuse.fetch_add(allocated_size); + if(memory_inuse.load() > max_memory_in_use.load()) { + max_memory_in_use.store(cur_memory + allocated_size); + RedisModule_Log(nullptr, "warning", "max onnx memory reached: %llu", max_memory_in_use.load()); + } num_allocator_access.fetch_add(1); // This operation guarantees that p2 is the closest 64-aligned address to (p1+size_t). void **aligned_address = (void **)(((size_t)(allocated_address) + offset) & (~63)); diff --git a/src/backends/onnxruntime.c b/src/backends/onnxruntime.c index ad7a27bd6..407eba85d 100644 --- a/src/backends/onnxruntime.c +++ b/src/backends/onnxruntime.c @@ -316,9 +316,9 @@ 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)) - //global_allocator = CreateCustomAllocator(1000000); - //ONNX_VALIDATE_STATUS(ort->RegisterAllocator(env, global_allocator)) - ONNX_VALIDATE_STATUS(ort->GetAllocatorWithDefaultOptions(&global_allocator)) + global_allocator = CreateCustomAllocator(1000000000); + ONNX_VALIDATE_STATUS(ort->RegisterAllocator(env, global_allocator)) + //ONNX_VALIDATE_STATUS(ort->GetAllocatorWithDefaultOptions(&global_allocator)) } ONNX_VALIDATE_STATUS(ort->CreateSessionOptions(&session_options)) From c0363c882d56ea802982888a7bc24cf5d1ab4bfc Mon Sep 17 00:00:00 2001 From: alon Date: Sat, 4 Sep 2021 19:40:19 +0300 Subject: [PATCH 12/31] wip - allocator benchmark --- src/backends/onnxruntime.c | 2 +- tests/flow/tests_onnx.py | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/backends/onnxruntime.c b/src/backends/onnxruntime.c index 407eba85d..17ebaed2b 100644 --- a/src/backends/onnxruntime.c +++ b/src/backends/onnxruntime.c @@ -316,7 +316,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)) - global_allocator = CreateCustomAllocator(1000000000); + global_allocator = CreateCustomAllocator(2000000000); ONNX_VALIDATE_STATUS(ort->RegisterAllocator(env, global_allocator)) //ONNX_VALIDATE_STATUS(ort->GetAllocatorWithDefaultOptions(&global_allocator)) } diff --git a/tests/flow/tests_onnx.py b/tests/flow/tests_onnx.py index aa2ee836b..031861254 100644 --- a/tests/flow/tests_onnx.py +++ b/tests/flow/tests_onnx.py @@ -510,3 +510,39 @@ 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_benchmark_allocator(): + env = Env(moduleArgs='THREADS_PER_QUEUE 8') + con = get_connection(env, '{1}') + + model_pb = load_file_content('mnist.onnx') + sample_raw = load_file_content('one.raw') + for i in range(50): + ret = con.execute_command('AI.MODELSTORE', 'mnist{1}'+str(i), 'ONNX', DEVICE, 'BLOB', model_pb) + env.assertEqual(ret, b'OK') + con.execute_command('AI.TENSORSET', 'a{1}', 'FLOAT', 1, 1, 28, 28, 'BLOB', sample_raw) + + inception_pb = load_file_content('inception-v2-9.onnx') + for i in range(20): + ret = con.execute_command('AI.MODELSTORE', 'inception{1}'+str(i), 'ONNX', DEVICE, 'BLOB', inception_pb) + env.assertEqual(ret, b'OK') + _, _, _, _, img = load_mobilenet_v2_test_data() + ret = con.execute_command('AI.TENSORSET', 't{1}', 'FLOAT', 1, 3, 224, 224, 'BLOB', img.tobytes()) + env.assertEqual(ret, b'OK') + + x=input() + + def run_parallel_onnx_sessions(con, model, input): + for i in range(1000): + ret = con.execute_command('AI.MODELEXECUTE', model, 'INPUTS', 1, input, 'OUTPUTS', 1, 'b{1}') + env.assertEqual(ret, b'OK') + + def run(): + run_test_multiproc(env, '{1}', 8, run_parallel_onnx_sessions, ('mnist{1}0', 'a{1}')) + + t = threading.Thread(target=run) + t.start() + + run_test_multiproc(env, '{1}', 8, run_parallel_onnx_sessions, ('inception{1}0', 't{1}')) + t.join() From 2e42c8e0ca3f3bf7ed1cbaa30f2a9c44352c4fa1 Mon Sep 17 00:00:00 2001 From: alon Date: Sun, 5 Sep 2021 12:46:35 +0300 Subject: [PATCH 13/31] create more complicated benchmarks --- .../onnx_allocator/onnx_allocator.cpp | 4 +- src/backends/onnxruntime.c | 2 +- tests/flow/tests_onnx.py | 51 +++++++++++++++---- 3 files changed, 45 insertions(+), 12 deletions(-) diff --git a/src/backends/onnx_allocator/onnx_allocator.cpp b/src/backends/onnx_allocator/onnx_allocator.cpp index ebd45af65..a43a305b3 100644 --- a/src/backends/onnx_allocator/onnx_allocator.cpp +++ b/src/backends/onnx_allocator/onnx_allocator.cpp @@ -56,10 +56,10 @@ void* RAIOrtAllocator::Alloc(size_t size) { throw Ort::Exception("Onnxruntime memory limit exceeded, memory allocation failed.", ORT_RUNTIME_EXCEPTION); } memory_inuse.fetch_add(allocated_size); - if(memory_inuse.load() > max_memory_in_use.load()) { + /*if(memory_inuse.load() > max_memory_in_use.load()) { max_memory_in_use.store(cur_memory + allocated_size); RedisModule_Log(nullptr, "warning", "max onnx memory reached: %llu", max_memory_in_use.load()); - } + }*/ num_allocator_access.fetch_add(1); // This operation guarantees that p2 is the closest 64-aligned address to (p1+size_t). void **aligned_address = (void **)(((size_t)(allocated_address) + offset) & (~63)); diff --git a/src/backends/onnxruntime.c b/src/backends/onnxruntime.c index 17ebaed2b..9f222648f 100644 --- a/src/backends/onnxruntime.c +++ b/src/backends/onnxruntime.c @@ -316,7 +316,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)) - global_allocator = CreateCustomAllocator(2000000000); + global_allocator = CreateCustomAllocator(10000000000); ONNX_VALIDATE_STATUS(ort->RegisterAllocator(env, global_allocator)) //ONNX_VALIDATE_STATUS(ort->GetAllocatorWithDefaultOptions(&global_allocator)) } diff --git a/tests/flow/tests_onnx.py b/tests/flow/tests_onnx.py index 031861254..20cf13eea 100644 --- a/tests/flow/tests_onnx.py +++ b/tests/flow/tests_onnx.py @@ -1,7 +1,10 @@ +import numpy as np import sys import os import subprocess import redis +import time + from includes import * from RLTest import Env @@ -521,28 +524,58 @@ def test_benchmark_allocator(): for i in range(50): ret = con.execute_command('AI.MODELSTORE', 'mnist{1}'+str(i), 'ONNX', DEVICE, 'BLOB', model_pb) env.assertEqual(ret, b'OK') - con.execute_command('AI.TENSORSET', 'a{1}', 'FLOAT', 1, 1, 28, 28, 'BLOB', sample_raw) + con.execute_command('AI.TENSORSET', 'mnist_in{1}', 'FLOAT', 1, 1, 28, 28, 'BLOB', sample_raw) inception_pb = load_file_content('inception-v2-9.onnx') for i in range(20): ret = con.execute_command('AI.MODELSTORE', 'inception{1}'+str(i), 'ONNX', DEVICE, 'BLOB', inception_pb) env.assertEqual(ret, b'OK') _, _, _, _, img = load_mobilenet_v2_test_data() - ret = con.execute_command('AI.TENSORSET', 't{1}', 'FLOAT', 1, 3, 224, 224, 'BLOB', img.tobytes()) + ret = con.execute_command('AI.TENSORSET', 'inception_in{1}', 'FLOAT', 1, 3, 224, 224, 'BLOB', img.tobytes()) env.assertEqual(ret, b'OK') - x=input() + bert_pb = load_file_content('bert-base-cased.onnx') + ret = con.execute_command('AI.MODELSTORE', 'bert{1}', 'ONNX', DEVICE, 'BLOB', bert_pb) + env.assertEqual(ret, b'OK') + bert_in_data = np.random.randint(-2, 1, size=(10,50), dtype=np.int64) + ret = con.execute_command('AI.TENSORSET', 'bert_in{1}', 'INT64', 10, 50, 'BLOB', bert_in_data.tobytes()) + env.assertEqual(ret, b'OK') def run_parallel_onnx_sessions(con, model, input): - for i in range(1000): - ret = con.execute_command('AI.MODELEXECUTE', model, 'INPUTS', 1, input, 'OUTPUTS', 1, 'b{1}') + for i in range(100): + if model == 'bert{1}': + ret = con.execute_command('AI.MODELEXECUTE', model, 'INPUTS', 3, input, input, input, + 'OUTPUTS', 2, 'res{1}', 'res2{1}') + else: + ret = con.execute_command('AI.MODELEXECUTE', model, 'INPUTS', 1, input, 'OUTPUTS', 1, 'res{1}') env.assertEqual(ret, b'OK') - def run(): - run_test_multiproc(env, '{1}', 8, run_parallel_onnx_sessions, ('mnist{1}0', 'a{1}')) + def run_mnist(): + run_test_multiproc(env, '{1}', 8, run_parallel_onnx_sessions, ('mnist{1}0', 'mnist_in{1}')) - t = threading.Thread(target=run) + def run_bert(): + run_test_multiproc(env, '{1}', 8, run_parallel_onnx_sessions, ('bert{1}', 'bert_in{1}')) + + start_time = time.time() + t = threading.Thread(target=run_mnist) t.start() - run_test_multiproc(env, '{1}', 8, run_parallel_onnx_sessions, ('inception{1}0', 't{1}')) + t2 = threading.Thread(target=run_bert) + t2.start() + + run_test_multiproc(env, '{1}', 8, run_parallel_onnx_sessions, ('inception{1}0', 'inception_in{1}')) t.join() + t2.join() + env.debugPrint("Total execution time is: {}".format(time.time()-start_time), force=True) + + +def test_benchmark_allocator_create_session(env): + con = get_connection(env, '{1}') + + bert_pb = load_file_content('bert-base-cased.onnx') + start_time = time.time() + for _ in range(10): + for i in range(10): + ret = con.execute_command('AI.MODELSTORE', 'bert{1}'+str(i), 'ONNX', DEVICE, 'BLOB', bert_pb) + env.assertEqual(ret, b'OK') + env.debugPrint("Total execution time is: {}".format(time.time()-start_time), force=True) From 4148fec2958fbe3055e9acfa31f5fb6a5949699e Mon Sep 17 00:00:00 2001 From: alon Date: Sun, 5 Sep 2021 12:47:27 +0300 Subject: [PATCH 14/31] upload models --- tests/flow/test_data/bert-base-cased.onnx | 3 +++ tests/flow/test_data/inception-v2-9.onnx | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 tests/flow/test_data/bert-base-cased.onnx create mode 100644 tests/flow/test_data/inception-v2-9.onnx diff --git a/tests/flow/test_data/bert-base-cased.onnx b/tests/flow/test_data/bert-base-cased.onnx new file mode 100644 index 000000000..17c5e8182 --- /dev/null +++ b/tests/flow/test_data/bert-base-cased.onnx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c8b29b06415e08f3d0de97e47ec94ccd6ce6ed52cef0cc1202bb13b3cdff4d45 +size 433311846 diff --git a/tests/flow/test_data/inception-v2-9.onnx b/tests/flow/test_data/inception-v2-9.onnx new file mode 100644 index 000000000..21aafc68a --- /dev/null +++ b/tests/flow/test_data/inception-v2-9.onnx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:37ed4aa93f817fd0d1cc19bda045ebd70f18d0887a5f51e66ecd0ed8fd5a65c2 +size 45042799 From 0f20247f84c8f8c8e4bf7aac72bc4156c9a413da Mon Sep 17 00:00:00 2001 From: alon Date: Thu, 9 Sep 2021 17:43:23 +0300 Subject: [PATCH 15/31] Add more test cases for benchmark --- tests/flow/tests_onnx.py | 51 +++++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/tests/flow/tests_onnx.py b/tests/flow/tests_onnx.py index 20cf13eea..ea8ec4eb3 100644 --- a/tests/flow/tests_onnx.py +++ b/tests/flow/tests_onnx.py @@ -516,28 +516,29 @@ def test_multiple_devices(self): def test_benchmark_allocator(): - env = Env(moduleArgs='THREADS_PER_QUEUE 8') + env = Env(moduleArgs='THREADS_PER_QUEUE 1') con = get_connection(env, '{1}') model_pb = load_file_content('mnist.onnx') sample_raw = load_file_content('one.raw') + inception_pb = load_file_content('inception-v2-9.onnx') + _, _, _, _, img = load_mobilenet_v2_test_data() + bert_pb = load_file_content('bert-base-cased.onnx') + bert_in_data = np.random.randint(-2, 1, size=(10,50), dtype=np.int64) + for i in range(50): ret = con.execute_command('AI.MODELSTORE', 'mnist{1}'+str(i), 'ONNX', DEVICE, 'BLOB', model_pb) env.assertEqual(ret, b'OK') con.execute_command('AI.TENSORSET', 'mnist_in{1}', 'FLOAT', 1, 1, 28, 28, 'BLOB', sample_raw) - inception_pb = load_file_content('inception-v2-9.onnx') for i in range(20): ret = con.execute_command('AI.MODELSTORE', 'inception{1}'+str(i), 'ONNX', DEVICE, 'BLOB', inception_pb) env.assertEqual(ret, b'OK') - _, _, _, _, img = load_mobilenet_v2_test_data() ret = con.execute_command('AI.TENSORSET', 'inception_in{1}', 'FLOAT', 1, 3, 224, 224, 'BLOB', img.tobytes()) env.assertEqual(ret, b'OK') - bert_pb = load_file_content('bert-base-cased.onnx') ret = con.execute_command('AI.MODELSTORE', 'bert{1}', 'ONNX', DEVICE, 'BLOB', bert_pb) env.assertEqual(ret, b'OK') - bert_in_data = np.random.randint(-2, 1, size=(10,50), dtype=np.int64) ret = con.execute_command('AI.TENSORSET', 'bert_in{1}', 'INT64', 10, 50, 'BLOB', bert_in_data.tobytes()) env.assertEqual(ret, b'OK') @@ -551,10 +552,10 @@ def run_parallel_onnx_sessions(con, model, input): env.assertEqual(ret, b'OK') def run_mnist(): - run_test_multiproc(env, '{1}', 8, run_parallel_onnx_sessions, ('mnist{1}0', 'mnist_in{1}')) + run_test_multiproc(env, '{1}', 1, run_parallel_onnx_sessions, ('mnist{1}0', 'mnist_in{1}')) def run_bert(): - run_test_multiproc(env, '{1}', 8, run_parallel_onnx_sessions, ('bert{1}', 'bert_in{1}')) + run_test_multiproc(env, '{1}', 1, run_parallel_onnx_sessions, ('bert{1}', 'bert_in{1}')) start_time = time.time() t = threading.Thread(target=run_mnist) @@ -563,10 +564,42 @@ def run_bert(): t2 = threading.Thread(target=run_bert) t2.start() - run_test_multiproc(env, '{1}', 8, run_parallel_onnx_sessions, ('inception{1}0', 'inception_in{1}')) + run_test_multiproc(env, '{1}', 1, run_parallel_onnx_sessions, ('inception{1}0', 'inception_in{1}')) t.join() t2.join() - env.debugPrint("Total execution time is: {}".format(time.time()-start_time), force=True) + env.debugPrint("Total execution time of all models with one thread is: {}".format(time.time()-start_time), force=True) + + env = Env(moduleArgs='THREADS_PER_QUEUE 4') + for i in range(50): + ret = con.execute_command('AI.MODELSTORE', 'mnist{1}'+str(i), 'ONNX', DEVICE, 'BLOB', model_pb) + env.assertEqual(ret, b'OK') + con.execute_command('AI.TENSORSET', 'mnist_in{1}', 'FLOAT', 1, 1, 28, 28, 'BLOB', sample_raw) + + for i in range(20): + ret = con.execute_command('AI.MODELSTORE', 'inception{1}'+str(i), 'ONNX', DEVICE, 'BLOB', inception_pb) + env.assertEqual(ret, b'OK') + ret = con.execute_command('AI.TENSORSET', 'inception_in{1}', 'FLOAT', 1, 3, 224, 224, 'BLOB', img.tobytes()) + env.assertEqual(ret, b'OK') + + ret = con.execute_command('AI.MODELSTORE', 'bert{1}', 'ONNX', DEVICE, 'BLOB', bert_pb) + env.assertEqual(ret, b'OK') + ret = con.execute_command('AI.TENSORSET', 'bert_in{1}', 'INT64', 10, 50, 'BLOB', bert_in_data.tobytes()) + env.assertEqual(ret, b'OK') + + # run only mnist with multiple threads + start_time = time.time() + run_test_multiproc(env, '{1}', 4, run_parallel_onnx_sessions, ('mnist{1}0', 'mnist_in{1}')) + env.debugPrint("Total execution time of mnist with multiple threads is: {}".format(time.time()-start_time), force=True) + + # run only inception with multiple threads + start_time = time.time() + run_test_multiproc(env, '{1}', 4, run_parallel_onnx_sessions, ('inception{1}0', 'inception_in{1}')) + env.debugPrint("Total execution time of inception with multiple threads is: {}".format(time.time()-start_time), force=True) + + # run only bert with multiple threads + start_time = time.time() + run_test_multiproc(env, '{1}', 4, run_parallel_onnx_sessions, ('bert{1}', 'bert_in{1}')) + env.debugPrint("Total execution time of bert with multiple threads is: {}".format(time.time()-start_time), force=True) def test_benchmark_allocator_create_session(env): From b36c413294a8d14c1f99d85556b0e125bc911665 Mon Sep 17 00:00:00 2001 From: alon Date: Thu, 9 Sep 2021 19:14:51 +0300 Subject: [PATCH 16/31] increase bert input to (100,10), change the number of runs for each model --- tests/flow/tests_onnx.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/flow/tests_onnx.py b/tests/flow/tests_onnx.py index ea8ec4eb3..0000abecb 100644 --- a/tests/flow/tests_onnx.py +++ b/tests/flow/tests_onnx.py @@ -524,7 +524,7 @@ def test_benchmark_allocator(): inception_pb = load_file_content('inception-v2-9.onnx') _, _, _, _, img = load_mobilenet_v2_test_data() bert_pb = load_file_content('bert-base-cased.onnx') - bert_in_data = np.random.randint(-2, 1, size=(10,50), dtype=np.int64) + bert_in_data = np.random.randint(-2, 1, size=(10, 100), dtype=np.int64) for i in range(50): ret = con.execute_command('AI.MODELSTORE', 'mnist{1}'+str(i), 'ONNX', DEVICE, 'BLOB', model_pb) @@ -539,11 +539,11 @@ def test_benchmark_allocator(): ret = con.execute_command('AI.MODELSTORE', 'bert{1}', 'ONNX', DEVICE, 'BLOB', bert_pb) env.assertEqual(ret, b'OK') - ret = con.execute_command('AI.TENSORSET', 'bert_in{1}', 'INT64', 10, 50, 'BLOB', bert_in_data.tobytes()) + ret = con.execute_command('AI.TENSORSET', 'bert_in{1}', 'INT64', 10, 100, 'BLOB', bert_in_data.tobytes()) env.assertEqual(ret, b'OK') - def run_parallel_onnx_sessions(con, model, input): - for i in range(100): + def run_parallel_onnx_sessions(con, model, input, num_runs): + for i in range(num_runs): if model == 'bert{1}': ret = con.execute_command('AI.MODELEXECUTE', model, 'INPUTS', 3, input, input, input, 'OUTPUTS', 2, 'res{1}', 'res2{1}') @@ -552,10 +552,10 @@ def run_parallel_onnx_sessions(con, model, input): env.assertEqual(ret, b'OK') def run_mnist(): - run_test_multiproc(env, '{1}', 1, run_parallel_onnx_sessions, ('mnist{1}0', 'mnist_in{1}')) + run_test_multiproc(env, '{1}', 1, run_parallel_onnx_sessions, ('mnist{1}0', 'mnist_in{1}', 10000)) def run_bert(): - run_test_multiproc(env, '{1}', 1, run_parallel_onnx_sessions, ('bert{1}', 'bert_in{1}')) + run_test_multiproc(env, '{1}', 1, run_parallel_onnx_sessions, ('bert{1}', 'bert_in{1}', 100)) start_time = time.time() t = threading.Thread(target=run_mnist) @@ -564,7 +564,7 @@ def run_bert(): t2 = threading.Thread(target=run_bert) t2.start() - run_test_multiproc(env, '{1}', 1, run_parallel_onnx_sessions, ('inception{1}0', 'inception_in{1}')) + run_test_multiproc(env, '{1}', 1, run_parallel_onnx_sessions, ('inception{1}0', 'inception_in{1}', 1000)) t.join() t2.join() env.debugPrint("Total execution time of all models with one thread is: {}".format(time.time()-start_time), force=True) @@ -583,22 +583,22 @@ def run_bert(): ret = con.execute_command('AI.MODELSTORE', 'bert{1}', 'ONNX', DEVICE, 'BLOB', bert_pb) env.assertEqual(ret, b'OK') - ret = con.execute_command('AI.TENSORSET', 'bert_in{1}', 'INT64', 10, 50, 'BLOB', bert_in_data.tobytes()) + ret = con.execute_command('AI.TENSORSET', 'bert_in{1}', 'INT64', 10, 100, 'BLOB', bert_in_data.tobytes()) env.assertEqual(ret, b'OK') # run only mnist with multiple threads start_time = time.time() - run_test_multiproc(env, '{1}', 4, run_parallel_onnx_sessions, ('mnist{1}0', 'mnist_in{1}')) + run_test_multiproc(env, '{1}', 4, run_parallel_onnx_sessions, ('mnist{1}0', 'mnist_in{1}', 10000)) env.debugPrint("Total execution time of mnist with multiple threads is: {}".format(time.time()-start_time), force=True) # run only inception with multiple threads start_time = time.time() - run_test_multiproc(env, '{1}', 4, run_parallel_onnx_sessions, ('inception{1}0', 'inception_in{1}')) + run_test_multiproc(env, '{1}', 4, run_parallel_onnx_sessions, ('inception{1}0', 'inception_in{1}', 1000)) env.debugPrint("Total execution time of inception with multiple threads is: {}".format(time.time()-start_time), force=True) # run only bert with multiple threads start_time = time.time() - run_test_multiproc(env, '{1}', 4, run_parallel_onnx_sessions, ('bert{1}', 'bert_in{1}')) + run_test_multiproc(env, '{1}', 4, run_parallel_onnx_sessions, ('bert{1}', 'bert_in{1}', 100)) env.debugPrint("Total execution time of bert with multiple threads is: {}".format(time.time()-start_time), force=True) From e004ad2431dd29175e8393e9390ec1f23f9e5230 Mon Sep 17 00:00:00 2001 From: alon Date: Sun, 12 Sep 2021 17:21:31 +0300 Subject: [PATCH 17/31] add slow-log usage for measuring server latency only --- .../onnx_allocator/onnx_allocator.cpp | 4 +-- tests/flow/tests_onnx.py | 31 ++++++++++++++++--- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/backends/onnx_allocator/onnx_allocator.cpp b/src/backends/onnx_allocator/onnx_allocator.cpp index a43a305b3..ebd45af65 100644 --- a/src/backends/onnx_allocator/onnx_allocator.cpp +++ b/src/backends/onnx_allocator/onnx_allocator.cpp @@ -56,10 +56,10 @@ void* RAIOrtAllocator::Alloc(size_t size) { throw Ort::Exception("Onnxruntime memory limit exceeded, memory allocation failed.", ORT_RUNTIME_EXCEPTION); } memory_inuse.fetch_add(allocated_size); - /*if(memory_inuse.load() > max_memory_in_use.load()) { + if(memory_inuse.load() > max_memory_in_use.load()) { max_memory_in_use.store(cur_memory + allocated_size); RedisModule_Log(nullptr, "warning", "max onnx memory reached: %llu", max_memory_in_use.load()); - }*/ + } num_allocator_access.fetch_add(1); // This operation guarantees that p2 is the closest 64-aligned address to (p1+size_t). void **aligned_address = (void **)(((size_t)(allocated_address) + offset) & (~63)); diff --git a/tests/flow/tests_onnx.py b/tests/flow/tests_onnx.py index 0000abecb..f56715a93 100644 --- a/tests/flow/tests_onnx.py +++ b/tests/flow/tests_onnx.py @@ -518,7 +518,8 @@ def test_multiple_devices(self): def test_benchmark_allocator(): env = Env(moduleArgs='THREADS_PER_QUEUE 1') con = get_connection(env, '{1}') - + con.execute_command('CONFIG', 'SET', 'slowlog-max-len', 100000) + con.execute_command('CONFIG', 'SET', 'slowlog-log-slower-than', 0) model_pb = load_file_content('mnist.onnx') sample_raw = load_file_content('one.raw') inception_pb = load_file_content('inception-v2-9.onnx') @@ -552,10 +553,10 @@ def run_parallel_onnx_sessions(con, model, input, num_runs): env.assertEqual(ret, b'OK') def run_mnist(): - run_test_multiproc(env, '{1}', 1, run_parallel_onnx_sessions, ('mnist{1}0', 'mnist_in{1}', 10000)) + run_test_multiproc(env, '{1}', 1, run_parallel_onnx_sessions, ('mnist{1}0', 'mnist_in{1}', 10)) def run_bert(): - run_test_multiproc(env, '{1}', 1, run_parallel_onnx_sessions, ('bert{1}', 'bert_in{1}', 100)) + run_test_multiproc(env, '{1}', 1, run_parallel_onnx_sessions, ('bert{1}', 'bert_in{1}', 10)) start_time = time.time() t = threading.Thread(target=run_mnist) @@ -564,12 +565,19 @@ def run_bert(): t2 = threading.Thread(target=run_bert) t2.start() - run_test_multiproc(env, '{1}', 1, run_parallel_onnx_sessions, ('inception{1}0', 'inception_in{1}', 1000)) + run_test_multiproc(env, '{1}', 1, run_parallel_onnx_sessions, ('inception{1}0', 'inception_in{1}', 10)) t.join() t2.join() env.debugPrint("Total execution time of all models with one thread is: {}".format(time.time()-start_time), force=True) + slow_log = con.execute_command('SLOWLOG', 'GET', -1) + times = [x[2] for x in slow_log if x[3][0] == b'AI.MODELEXECUTE'] + print(times) + total_time = sum([int(x[2]) for x in slow_log if x[3][0] == b'AI.MODELEXECUTE']) + env.debugPrint("total server time is: {}".format(float(total_time)/1000000), force=True) env = Env(moduleArgs='THREADS_PER_QUEUE 4') + con.execute_command('CONFIG', 'SET', 'slowlog-max-len', 100000) + con.execute_command('CONFIG', 'SET', 'slowlog-log-slower-than', 0) for i in range(50): ret = con.execute_command('AI.MODELSTORE', 'mnist{1}'+str(i), 'ONNX', DEVICE, 'BLOB', model_pb) env.assertEqual(ret, b'OK') @@ -590,16 +598,31 @@ def run_bert(): start_time = time.time() run_test_multiproc(env, '{1}', 4, run_parallel_onnx_sessions, ('mnist{1}0', 'mnist_in{1}', 10000)) env.debugPrint("Total execution time of mnist with multiple threads is: {}".format(time.time()-start_time), force=True) + slow_log = con.execute_command('SLOWLOG', 'GET', -1) + times = [x[2] for x in slow_log if x[3][0] == b'AI.MODELEXECUTE'] + print(times) + total_time = sum([int(x[2]) for x in slow_log if x[3][0] == b'AI.MODELEXECUTE']) + env.debugPrint("total server time is: {}".format(float(total_time)/1000000), force=True) # run only inception with multiple threads start_time = time.time() run_test_multiproc(env, '{1}', 4, run_parallel_onnx_sessions, ('inception{1}0', 'inception_in{1}', 1000)) env.debugPrint("Total execution time of inception with multiple threads is: {}".format(time.time()-start_time), force=True) + slow_log = con.execute_command('SLOWLOG', 'GET', 4000) + times = [x[2] for x in slow_log if x[3][0] == b'AI.MODELEXECUTE'] + print(times) + total_time = sum([int(x[2]) for x in slow_log if x[3][0] == b'AI.MODELEXECUTE']) + env.debugPrint("total server time is: {}".format(float(total_time)/1000000), force=True) # run only bert with multiple threads start_time = time.time() run_test_multiproc(env, '{1}', 4, run_parallel_onnx_sessions, ('bert{1}', 'bert_in{1}', 100)) env.debugPrint("Total execution time of bert with multiple threads is: {}".format(time.time()-start_time), force=True) + slow_log = con.execute_command('SLOWLOG', 'GET', 400) + times = [x[2] for x in slow_log if x[3][0] == b'AI.MODELEXECUTE'] + print(times) + total_time = sum([int(x[2]) for x in slow_log if x[3][0] == b'AI.MODELEXECUTE']) + env.debugPrint("total server time is: {}".format(float(total_time)/1000000), force=True) def test_benchmark_allocator_create_session(env): From e9dd6546162c5f975cdf8dec678acef93272883c Mon Sep 17 00:00:00 2001 From: alon Date: Sun, 12 Sep 2021 22:10:32 +0300 Subject: [PATCH 18/31] use ai.info instead of slowlog --- tests/flow/tests_onnx.py | 46 +++++++++++++++++----------------------- 1 file changed, 19 insertions(+), 27 deletions(-) diff --git a/tests/flow/tests_onnx.py b/tests/flow/tests_onnx.py index f56715a93..f75ad9af8 100644 --- a/tests/flow/tests_onnx.py +++ b/tests/flow/tests_onnx.py @@ -518,8 +518,7 @@ def test_multiple_devices(self): def test_benchmark_allocator(): env = Env(moduleArgs='THREADS_PER_QUEUE 1') con = get_connection(env, '{1}') - con.execute_command('CONFIG', 'SET', 'slowlog-max-len', 100000) - con.execute_command('CONFIG', 'SET', 'slowlog-log-slower-than', 0) + model_pb = load_file_content('mnist.onnx') sample_raw = load_file_content('one.raw') inception_pb = load_file_content('inception-v2-9.onnx') @@ -553,10 +552,10 @@ def run_parallel_onnx_sessions(con, model, input, num_runs): env.assertEqual(ret, b'OK') def run_mnist(): - run_test_multiproc(env, '{1}', 1, run_parallel_onnx_sessions, ('mnist{1}0', 'mnist_in{1}', 10)) + run_test_multiproc(env, '{1}', 1, run_parallel_onnx_sessions, ('mnist{1}0', 'mnist_in{1}', 10000)) def run_bert(): - run_test_multiproc(env, '{1}', 1, run_parallel_onnx_sessions, ('bert{1}', 'bert_in{1}', 10)) + run_test_multiproc(env, '{1}', 1, run_parallel_onnx_sessions, ('bert{1}', 'bert_in{1}', 100)) start_time = time.time() t = threading.Thread(target=run_mnist) @@ -565,19 +564,18 @@ def run_bert(): t2 = threading.Thread(target=run_bert) t2.start() - run_test_multiproc(env, '{1}', 1, run_parallel_onnx_sessions, ('inception{1}0', 'inception_in{1}', 10)) + run_test_multiproc(env, '{1}', 1, run_parallel_onnx_sessions, ('inception{1}0', 'inception_in{1}', 1000)) t.join() t2.join() env.debugPrint("Total execution time of all models with one thread is: {}".format(time.time()-start_time), force=True) - slow_log = con.execute_command('SLOWLOG', 'GET', -1) - times = [x[2] for x in slow_log if x[3][0] == b'AI.MODELEXECUTE'] - print(times) - total_time = sum([int(x[2]) for x in slow_log if x[3][0] == b'AI.MODELEXECUTE']) - env.debugPrint("total server time is: {}".format(float(total_time)/1000000), force=True) + mnist_info = con.execute_command('AI.INFO', 'mnist{1}0')[11] + inception_info = con.execute_command('AI.INFO', 'inception{1}0')[11] + bert_info = con.execute_command('AI.INFO', 'bert{1}')[11] + total_time = mnist_info+inception_info+bert_info + env.debugPrint("Avg server time of all models with one thread is: {}".format(float(total_time)/1000000/11100), force=True) env = Env(moduleArgs='THREADS_PER_QUEUE 4') - con.execute_command('CONFIG', 'SET', 'slowlog-max-len', 100000) - con.execute_command('CONFIG', 'SET', 'slowlog-log-slower-than', 0) + for i in range(50): ret = con.execute_command('AI.MODELSTORE', 'mnist{1}'+str(i), 'ONNX', DEVICE, 'BLOB', model_pb) env.assertEqual(ret, b'OK') @@ -598,31 +596,25 @@ def run_bert(): start_time = time.time() run_test_multiproc(env, '{1}', 4, run_parallel_onnx_sessions, ('mnist{1}0', 'mnist_in{1}', 10000)) env.debugPrint("Total execution time of mnist with multiple threads is: {}".format(time.time()-start_time), force=True) - slow_log = con.execute_command('SLOWLOG', 'GET', -1) - times = [x[2] for x in slow_log if x[3][0] == b'AI.MODELEXECUTE'] - print(times) - total_time = sum([int(x[2]) for x in slow_log if x[3][0] == b'AI.MODELEXECUTE']) - env.debugPrint("total server time is: {}".format(float(total_time)/1000000), force=True) + mnist_time = con.execute_command('AI.INFO', 'mnist{1}0')[11] + print(str(con.execute_command('AI.INFO', 'mnist{1}0'))) + env.debugPrint("Avg server time of mnist with multiple threads is:{}".format(float(mnist_time)/1000000/40000), force=True) # run only inception with multiple threads start_time = time.time() run_test_multiproc(env, '{1}', 4, run_parallel_onnx_sessions, ('inception{1}0', 'inception_in{1}', 1000)) env.debugPrint("Total execution time of inception with multiple threads is: {}".format(time.time()-start_time), force=True) - slow_log = con.execute_command('SLOWLOG', 'GET', 4000) - times = [x[2] for x in slow_log if x[3][0] == b'AI.MODELEXECUTE'] - print(times) - total_time = sum([int(x[2]) for x in slow_log if x[3][0] == b'AI.MODELEXECUTE']) - env.debugPrint("total server time is: {}".format(float(total_time)/1000000), force=True) + inception_time = con.execute_command('AI.INFO', 'inception{1}0')[11] + print(str(con.execute_command('AI.INFO', 'inception{1}0'))) + env.debugPrint("Avg server time of inception with multiple threads is: {}".format(float(inception_time)/1000000/4000), force=True) # run only bert with multiple threads start_time = time.time() run_test_multiproc(env, '{1}', 4, run_parallel_onnx_sessions, ('bert{1}', 'bert_in{1}', 100)) env.debugPrint("Total execution time of bert with multiple threads is: {}".format(time.time()-start_time), force=True) - slow_log = con.execute_command('SLOWLOG', 'GET', 400) - times = [x[2] for x in slow_log if x[3][0] == b'AI.MODELEXECUTE'] - print(times) - total_time = sum([int(x[2]) for x in slow_log if x[3][0] == b'AI.MODELEXECUTE']) - env.debugPrint("total server time is: {}".format(float(total_time)/1000000), force=True) + bert_time = con.execute_command('AI.INFO', 'bert{1}')[11] + print(str(con.execute_command('AI.INFO', 'bert{1}'))) + env.debugPrint("Avg server time of bert with multiple threads is: {}".format(float(bert_time)/1000000/400), force=True) def test_benchmark_allocator_create_session(env): From 90ffc9048c6e3c5654f19fa813890adf9195f6b5 Mon Sep 17 00:00:00 2001 From: alon Date: Mon, 13 Sep 2021 10:43:16 +0300 Subject: [PATCH 19/31] use existing env --- tests/flow/tests_onnx.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/flow/tests_onnx.py b/tests/flow/tests_onnx.py index f75ad9af8..aff91e7cb 100644 --- a/tests/flow/tests_onnx.py +++ b/tests/flow/tests_onnx.py @@ -516,7 +516,7 @@ def test_multiple_devices(self): def test_benchmark_allocator(): - env = Env(moduleArgs='THREADS_PER_QUEUE 1') + env = Env(env='existing-env', moduleArgs='THREADS_PER_QUEUE 1') con = get_connection(env, '{1}') model_pb = load_file_content('mnist.onnx') @@ -574,7 +574,7 @@ def run_bert(): total_time = mnist_info+inception_info+bert_info env.debugPrint("Avg server time of all models with one thread is: {}".format(float(total_time)/1000000/11100), force=True) - env = Env(moduleArgs='THREADS_PER_QUEUE 4') + env = Env(env='existing-env', moduleArgs='THREADS_PER_QUEUE 4') for i in range(50): ret = con.execute_command('AI.MODELSTORE', 'mnist{1}'+str(i), 'ONNX', DEVICE, 'BLOB', model_pb) From 5d2fbde590eeb1e6e8c730c038b8406c4aeda0a9 Mon Sep 17 00:00:00 2001 From: alon Date: Sun, 3 Oct 2021 09:37:04 +0300 Subject: [PATCH 20/31] WIP --- src/backends/onnxruntime.c | 8 ++++---- tests/flow/tests_onnx.py | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/backends/onnxruntime.c b/src/backends/onnxruntime.c index 9f222648f..a24e27c0b 100644 --- a/src/backends/onnxruntime.c +++ b/src/backends/onnxruntime.c @@ -316,9 +316,9 @@ 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)) - global_allocator = CreateCustomAllocator(10000000000); - ONNX_VALIDATE_STATUS(ort->RegisterAllocator(env, global_allocator)) - //ONNX_VALIDATE_STATUS(ort->GetAllocatorWithDefaultOptions(&global_allocator)) + //global_allocator = CreateCustomAllocator(10000000000); + //ONNX_VALIDATE_STATUS(ort->RegisterAllocator(env, global_allocator)) + ONNX_VALIDATE_STATUS(ort->GetAllocatorWithDefaultOptions(&global_allocator)) } ONNX_VALIDATE_STATUS(ort->CreateSessionOptions(&session_options)) @@ -327,7 +327,7 @@ RAI_Model *RAI_ModelCreateORT(RAI_Backend backend, const char *devicestr, RAI_Mo // a model that defined to run on CPU). ONNX_VALIDATE_STATUS( ort->AddSessionConfigEntry(session_options, "session.use_env_allocators", "1")) - ONNX_VALIDATE_STATUS(ort->DisableCpuMemArena(session_options)) + //ONNX_VALIDATE_STATUS(ort->DisableCpuMemArena(session_options)) } // TODO: these options could be configured at the AI.CONFIG level diff --git a/tests/flow/tests_onnx.py b/tests/flow/tests_onnx.py index aff91e7cb..083187eb1 100644 --- a/tests/flow/tests_onnx.py +++ b/tests/flow/tests_onnx.py @@ -516,7 +516,7 @@ def test_multiple_devices(self): def test_benchmark_allocator(): - env = Env(env='existing-env', moduleArgs='THREADS_PER_QUEUE 1') + env = Env(moduleArgs='THREADS_PER_QUEUE 1') con = get_connection(env, '{1}') model_pb = load_file_content('mnist.onnx') @@ -574,7 +574,7 @@ def run_bert(): total_time = mnist_info+inception_info+bert_info env.debugPrint("Avg server time of all models with one thread is: {}".format(float(total_time)/1000000/11100), force=True) - env = Env(env='existing-env', moduleArgs='THREADS_PER_QUEUE 4') + env = Env(moduleArgs='THREADS_PER_QUEUE 4') for i in range(50): ret = con.execute_command('AI.MODELSTORE', 'mnist{1}'+str(i), 'ONNX', DEVICE, 'BLOB', model_pb) @@ -594,27 +594,27 @@ def run_bert(): # run only mnist with multiple threads start_time = time.time() - run_test_multiproc(env, '{1}', 4, run_parallel_onnx_sessions, ('mnist{1}0', 'mnist_in{1}', 10000)) + run_test_multiproc(env, '{1}', 10, run_parallel_onnx_sessions, ('mnist{1}0', 'mnist_in{1}', 1000)) env.debugPrint("Total execution time of mnist with multiple threads is: {}".format(time.time()-start_time), force=True) mnist_time = con.execute_command('AI.INFO', 'mnist{1}0')[11] print(str(con.execute_command('AI.INFO', 'mnist{1}0'))) - env.debugPrint("Avg server time of mnist with multiple threads is:{}".format(float(mnist_time)/1000000/40000), force=True) + env.debugPrint("Avg server time of mnist with multiple threads is:{}".format(float(mnist_time)/1000000/10000), force=True) # run only inception with multiple threads start_time = time.time() - run_test_multiproc(env, '{1}', 4, run_parallel_onnx_sessions, ('inception{1}0', 'inception_in{1}', 1000)) + run_test_multiproc(env, '{1}', 10, run_parallel_onnx_sessions, ('inception{1}0', 'inception_in{1}', 100)) env.debugPrint("Total execution time of inception with multiple threads is: {}".format(time.time()-start_time), force=True) inception_time = con.execute_command('AI.INFO', 'inception{1}0')[11] print(str(con.execute_command('AI.INFO', 'inception{1}0'))) - env.debugPrint("Avg server time of inception with multiple threads is: {}".format(float(inception_time)/1000000/4000), force=True) + env.debugPrint("Avg server time of inception with multiple threads is: {}".format(float(inception_time)/1000000/1000), force=True) # run only bert with multiple threads start_time = time.time() - run_test_multiproc(env, '{1}', 4, run_parallel_onnx_sessions, ('bert{1}', 'bert_in{1}', 100)) + run_test_multiproc(env, '{1}', 10, run_parallel_onnx_sessions, ('bert{1}', 'bert_in{1}', 10)) env.debugPrint("Total execution time of bert with multiple threads is: {}".format(time.time()-start_time), force=True) bert_time = con.execute_command('AI.INFO', 'bert{1}')[11] print(str(con.execute_command('AI.INFO', 'bert{1}'))) - env.debugPrint("Avg server time of bert with multiple threads is: {}".format(float(bert_time)/1000000/400), force=True) + env.debugPrint("Avg server time of bert with multiple threads is: {}".format(float(bert_time)/1000000/100), force=True) def test_benchmark_allocator_create_session(env): From fd58367a247527e17a4e405e8525fbb93caaa6f2 Mon Sep 17 00:00:00 2001 From: alon Date: Sun, 3 Oct 2021 11:49:20 +0300 Subject: [PATCH 21/31] WIP - add memory limit as runtime configuration --- src/backends/backends.c | 2 ++ src/backends/backends_api.h | 12 ++++++++-- .../onnx_allocator/onnx_allocator.cpp | 14 ++++------- src/backends/onnxruntime.c | 9 ++++---- src/config/config.c | 23 +++++++++++++++++-- src/config/config.h | 18 ++++++++++++++- src/redisai.c | 2 ++ 7 files changed, 60 insertions(+), 20 deletions(-) diff --git a/src/backends/backends.c b/src/backends/backends.c index 02a17bcf8..59ec5a277 100644 --- a/src/backends/backends.c +++ b/src/backends/backends.c @@ -50,6 +50,8 @@ int RAI_ExportFunc(const char *func_name, void **targetFuncPtr) { *targetFuncPtr = Config_GetModelExecutionTimeout; } else if (strcmp("GetThreadsCount", func_name) == 0) { *targetFuncPtr = BGWorker_GetThreadsCount; + } else if (strcmp("GetBackendMemoryLimit", func_name) == 0) { + *targetFuncPtr = Config_GetBackendMemoryLimit; // Export RedisAI low level API functions. } else if (strcmp("RedisAI_InitError", func_name) == 0) { diff --git a/src/backends/backends_api.h b/src/backends/backends_api.h index 7d7919f27..13d2feeb5 100644 --- a/src/backends/backends_api.h +++ b/src/backends/backends_api.h @@ -37,12 +37,20 @@ BACKENDS_API uintptr_t (*RedisAI_GetThreadsCount)(void); BACKENDS_API long long (*RedisAI_GetNumThreadsPerQueue)(void); /** - * @return The maximal number of milliseconds that a model run session should run + * @return The maximum number of milliseconds that a model run session should run * before it is terminated forcefully (load time config). - * Currently supported only fo onnxruntime backend. + * Currently supported only for onnxruntime backend. */ BACKENDS_API long long (*RedisAI_GetModelExecutionTimeout)(void); +/** + * @return The maximum number of memory (in MB) that a backend can consume + * for creating and running inference sessions. When memory limit is exceeded, operation + * is not permitted and an error is returned. + * Currently supported only for onnxruntime backend. + */ +BACKENDS_API long long (*RedisAI_GetMemoryLimit)(void); + /** * The following functions are part of RedisAI low level API (the full low level * API is defined in redisai.h). For every function below named "RedisAI_X", its diff --git a/src/backends/onnx_allocator/onnx_allocator.cpp b/src/backends/onnx_allocator/onnx_allocator.cpp index ebd45af65..24d84f709 100644 --- a/src/backends/onnx_allocator/onnx_allocator.cpp +++ b/src/backends/onnx_allocator/onnx_allocator.cpp @@ -6,6 +6,8 @@ struct RAIOrtAllocator : OrtAllocator { RAIOrtAllocator(); ~RAIOrtAllocator(); + RAIOrtAllocator(const RAIOrtAllocator&) = delete; + RAIOrtAllocator& operator=(const RAIOrtAllocator&) = delete; void* Alloc(size_t size); void Free(void* p); @@ -16,12 +18,8 @@ struct RAIOrtAllocator : OrtAllocator { static RAIOrtAllocator *GetInstance(); private: - RAIOrtAllocator(const RAIOrtAllocator&) = delete; - RAIOrtAllocator& operator=(const RAIOrtAllocator&) = delete; - std::atomic memory_inuse{0}; std::atomic num_allocator_access{0}; - std::atomic max_memory_in_use{0}; unsigned long long memory_limit = 0; OrtMemoryInfo* cpu_memory_info; static RAIOrtAllocator* allocator_instance; @@ -52,14 +50,10 @@ void* RAIOrtAllocator::Alloc(size_t size) { // Update the total number of bytes that onnx is using and the number of accesses // that onnx made to the allocator. size_t cur_memory = memory_inuse.load(); - if (cur_memory + allocated_size > memory_limit) { + if (memory_limit && cur_memory + allocated_size > memory_limit) { throw Ort::Exception("Onnxruntime memory limit exceeded, memory allocation failed.", ORT_RUNTIME_EXCEPTION); } memory_inuse.fetch_add(allocated_size); - if(memory_inuse.load() > max_memory_in_use.load()) { - max_memory_in_use.store(cur_memory + allocated_size); - RedisModule_Log(nullptr, "warning", "max onnx memory reached: %llu", max_memory_in_use.load()); - } num_allocator_access.fetch_add(1); // This operation guarantees that p2 is the closest 64-aligned address to (p1+size_t). void **aligned_address = (void **)(((size_t)(allocated_address) + offset) & (~63)); @@ -69,7 +63,7 @@ void* RAIOrtAllocator::Alloc(size_t size) { } void RAIOrtAllocator::Free(void* p) { - if (p == NULL) { + if (p == nullptr) { return; } // Retrieve the address that we originally received from RedisModule_Alloc diff --git a/src/backends/onnxruntime.c b/src/backends/onnxruntime.c index a24e27c0b..d2d2a218d 100644 --- a/src/backends/onnxruntime.c +++ b/src/backends/onnxruntime.c @@ -41,6 +41,7 @@ int RAI_InitBackendORT(int (*get_api_fn)(const char *, void **)) { get_api_fn("GetThreadId", ((void **)&RedisAI_GetThreadId)); get_api_fn("GetNumThreadsPerQueue", ((void **)&RedisAI_GetNumThreadsPerQueue)); get_api_fn("GetModelExecutionTimeout", ((void **)&RedisAI_GetModelExecutionTimeout)); + get_api_fn("GetBackendMemoryLimit", ((void **)&RedisAI_GetMemoryLimit)); get_api_fn("GetThreadsCount", ((void **)&RedisAI_GetThreadsCount)); // Create a global array of onnx runSessions, with an entry for every working thread. @@ -315,10 +316,9 @@ RAI_Model *RAI_ModelCreateORT(RAI_Backend backend, const char *devicestr, RAI_Mo // allocating buffers when creating and running models that run on CPU, and for allocations of // 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)) - //global_allocator = CreateCustomAllocator(10000000000); - //ONNX_VALIDATE_STATUS(ort->RegisterAllocator(env, global_allocator)) - ONNX_VALIDATE_STATUS(ort->GetAllocatorWithDefaultOptions(&global_allocator)) + ONNX_VALIDATE_STATUS(ort->CreateEnv(ORT_LOGGING_LEVEL_WARNING, "RedisAI", &env)) + global_allocator = CreateCustomAllocator(RedisAI_GetMemoryLimit()); + ONNX_VALIDATE_STATUS(ort->RegisterAllocator(env, global_allocator)) } ONNX_VALIDATE_STATUS(ort->CreateSessionOptions(&session_options)) @@ -327,7 +327,6 @@ RAI_Model *RAI_ModelCreateORT(RAI_Backend backend, const char *devicestr, RAI_Mo // a model that defined to run on CPU). ONNX_VALIDATE_STATUS( ort->AddSessionConfigEntry(session_options, "session.use_env_allocators", "1")) - //ONNX_VALIDATE_STATUS(ort->DisableCpuMemArena(session_options)) } // TODO: these options could be configured at the AI.CONFIG level diff --git a/src/config/config.c b/src/config/config.c index e51d43692..4b5fdca99 100644 --- a/src/config/config.c +++ b/src/config/config.c @@ -14,8 +14,10 @@ long long ModelChunkSize = 535822336; // size of chunks used to break up mo // default is 511 * 1024 * 1024 long long ThreadPoolSizePerQueue = 1; // Number of working threads for device. -long long ModelExecutionTimeout = 5000; // The maximum time in milliseconds - // before killing onnx run session. +long long ModelExecutionTimeout = 5000; // The maximum time in milliseconds + // before killing onnx run session. +long long BackendMemoryLimit = 0; // The maximum amount of memory in MB + // that backend is allowed to consume. static int _Config_LoadTimeParamParse(RedisModuleCtx *ctx, const char *key, const char *val, RedisModuleString *rsval) { @@ -56,6 +58,11 @@ static int _Config_LoadTimeParamParse(RedisModuleCtx *ctx, const char *key, cons if (ret == REDISMODULE_OK) { RedisModule_Log(ctx, "notice", "%s: %s", REDISAI_INFOMSG_MODEL_EXECUTION_TIMEOUT, val); } + } else if (strcasecmp((key), "BACKEND_MEMORY_LIMIT") == 0) { + ret = Config_SetBackendMemoryLimit(rsval); + if (ret == REDISMODULE_OK) { + RedisModule_Log(ctx, "notice", "%s: %s", REDISAI_INFOMSG_BACKEND_MEMORY_LIMIT, val); + } } else if (strcasecmp((key), "BACKENDSPATH") == 0) { // already taken care of } else { @@ -74,6 +81,8 @@ long long Config_GetNumThreadsPerQueue() { return ThreadPoolSizePerQueue; } long long Config_GetModelExecutionTimeout() { return ModelExecutionTimeout; } +long long Config_GetBackendMemoryLimit() { return BackendMemoryLimit; } + char *Config_GetBackendsPath() { return BackendsPath; } int Config_LoadBackend(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) { @@ -160,6 +169,16 @@ int Config_SetModelExecutionTimeout(RedisModuleString *timeout) { return REDISMODULE_OK; } +int Config_SetBackendMemoryLimit(RedisModuleString *memory_limit) { + long long val; + int result = RedisModule_StringToLongLong(memory_limit, &val); + if (result != REDISMODULE_OK || val <= 0) { + return REDISMODULE_ERR; + } + BackendMemoryLimit = val; + return REDISMODULE_OK; +} + int Config_SetLoadTimeParams(RedisModuleCtx *ctx, RedisModuleString *const *argv, int argc) { if (argc > 0 && argc % 2 != 0) { RedisModule_Log(ctx, "warning", diff --git a/src/config/config.h b/src/config/config.h index 724cc509a..d6798f2f3 100644 --- a/src/config/config.h +++ b/src/config/config.h @@ -26,6 +26,7 @@ typedef enum { RAI_DEVICE_CPU = 0, RAI_DEVICE_GPU = 1 } RAI_Device; #define REDISAI_INFOMSG_INTER_OP_PARALLELISM "Setting INTER_OP_PARALLELISM parameter to" #define REDISAI_INFOMSG_MODEL_CHUNK_SIZE "Setting MODEL_CHUNK_SIZE parameter to" #define REDISAI_INFOMSG_MODEL_EXECUTION_TIMEOUT "Setting MODEL_EXECUTION_TIMEOUT parameter to" +#define REDISAI_INFOMSG_BACKEND_MEMORY_LIMIT "Setting BACKEND_MEMORY_LIMIT parameter to" /** * Get number of threads used for parallelism between independent operations, by @@ -56,6 +57,13 @@ long long Config_GetNumThreadsPerQueue(void); */ long long Config_GetModelExecutionTimeout(void); +/** + * @return Memory limit in MB for backend. This is the maximum amount of memory + * that can be consumed by the backend for creating and running sessions. + * Currently supported only for onnxruntime backend. + */ +long long Config_GetBackendMemoryLimit(void); + /** * @return Returns the backends path string. */ @@ -113,11 +121,19 @@ int Config_SetModelChunkSize(RedisModuleString *chunk_size_string); /** * Set the maximum time in ms that onnx backend allow running a model. - * @param onnx_max_runtime - string containing the max runtime (in ms) + * @param timeout - string containing the max runtime (in ms) * @return REDISMODULE_OK on success, or REDISMODULE_ERR if failed */ int Config_SetModelExecutionTimeout(RedisModuleString *timeout); +/** + * Set the memory limit in MB for backends allocations. + * @param memory_limit - maximum memory consumption by backend. If values is zero, + * there will be no enforcement of any memory limit. + * @return REDISMODULE_OK on success, or REDISMODULE_ERR if failed + */ +int Config_SetBackendMemoryLimit(RedisModuleString *memory_limit); + /** * Load time configuration parser * @param ctx Context in which Redis modules operate diff --git a/src/redisai.c b/src/redisai.c index 79d60e69e..dc1f77ec9 100644 --- a/src/redisai.c +++ b/src/redisai.c @@ -1195,6 +1195,8 @@ void RAI_moduleInfoFunc(RedisModuleInfoCtx *ctx, int for_crash_report) { Config_GetBackendsIntraOpParallelism()); RedisModule_InfoAddFieldLongLong(ctx, "model_execution_timeout", Config_GetModelExecutionTimeout()); + RedisModule_InfoAddFieldLongLong(ctx, "backend_memory_limit", + Config_GetBackendMemoryLimit()); _moduleInfo_getBackendsInfo(ctx); struct rusage self_ru, c_ru; From d684b645998cf1da858c3054b513614622e8d971 Mon Sep 17 00:00:00 2001 From: alon Date: Sun, 3 Oct 2021 12:45:00 +0300 Subject: [PATCH 22/31] WIP - add memory limit as runtime configuration --- tests/flow/tests_onnx.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/tests/flow/tests_onnx.py b/tests/flow/tests_onnx.py index db14ddaca..3061ebcb6 100644 --- a/tests/flow/tests_onnx.py +++ b/tests/flow/tests_onnx.py @@ -543,6 +543,8 @@ def test_multiple_devices(self): def test_benchmark_allocator(): + return # currently disabled + env = Env(moduleArgs='THREADS_PER_QUEUE 1') con = get_connection(env, '{1}') @@ -643,14 +645,3 @@ def run_bert(): print(str(con.execute_command('AI.INFO', 'bert{1}'))) env.debugPrint("Avg server time of bert with multiple threads is: {}".format(float(bert_time)/1000000/100), force=True) - -def test_benchmark_allocator_create_session(env): - con = get_connection(env, '{1}') - - bert_pb = load_file_content('bert-base-cased.onnx') - start_time = time.time() - for _ in range(10): - for i in range(10): - ret = con.execute_command('AI.MODELSTORE', 'bert{1}'+str(i), 'ONNX', DEVICE, 'BLOB', bert_pb) - env.assertEqual(ret, b'OK') - env.debugPrint("Total execution time is: {}".format(time.time()-start_time), force=True) From 22415bf549efc81ac41df965abee06e632aeba3e Mon Sep 17 00:00:00 2001 From: alon Date: Sun, 3 Oct 2021 14:16:31 +0300 Subject: [PATCH 23/31] WIP - add tests for custom allocator --- .../onnx_allocator/onnx_allocator.cpp | 3 +- tests/flow/tests_common.py | 3 +- tests/flow/tests_onnx.py | 193 +++++++++--------- 3 files changed, 99 insertions(+), 100 deletions(-) diff --git a/src/backends/onnx_allocator/onnx_allocator.cpp b/src/backends/onnx_allocator/onnx_allocator.cpp index 24d84f709..56b0615d2 100644 --- a/src/backends/onnx_allocator/onnx_allocator.cpp +++ b/src/backends/onnx_allocator/onnx_allocator.cpp @@ -90,7 +90,8 @@ unsigned long long RAIOrtAllocator::MemoryInUse() const { } void RAIOrtAllocator::SetMemoryLimit(unsigned long long max_memory) { - memory_limit = max_memory; + // max_memory is given in MB + memory_limit = 1000000*max_memory; } RAIOrtAllocator *RAIOrtAllocator::GetInstance() { diff --git a/tests/flow/tests_common.py b/tests/flow/tests_common.py index 8ca5d1c05..9e0579e2b 100644 --- a/tests/flow/tests_common.py +++ b/tests/flow/tests_common.py @@ -303,7 +303,8 @@ def test_info_command(env): env.assertEqual(list(git.keys()), ['ai_git_sha']) load_time_configs = get_info_section(con, 'load_time_configs') env.assertEqual(list(load_time_configs.keys()), ['ai_threads_per_queue', 'ai_inter_op_parallelism', - 'ai_intra_op_parallelism', 'ai_model_execution_timeout']) + 'ai_intra_op_parallelism', 'ai_model_execution_timeout', + 'ai_backend_memory_limit']) # minimum cpu properties cpu = get_info_section(con, 'cpu') env.assertTrue('ai_self_used_cpu_sys' in cpu.keys()) diff --git a/tests/flow/tests_onnx.py b/tests/flow/tests_onnx.py index 3061ebcb6..184494a8e 100644 --- a/tests/flow/tests_onnx.py +++ b/tests/flow/tests_onnx.py @@ -366,113 +366,110 @@ 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) +class TestOnnxCustomAllocator: + def __init__(self): + self.env = Env() + if not TEST_ONNX: + self.env.debugPrint("skipping {} since TEST_ONNX=0".format(sys._getframe().f_code.co_name), force=True) + return + self.allocator_access_counter = 0 - # 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) + def test_cpu_allocator(self): + con = get_connection(self.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 24B ,and the names are 2B each. In practice we allocate + # more than 28B 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) + self.env.assertEqual(ret, b'OK') + self.allocator_access_counter += 3 + backends_info = get_info_section(con, 'backends_info') - values = con.execute_command('AI.TENSORGET', 'b{1}', 'VALUES') - argmax = max(range(len(values)), key=lambda i: values[i]) - env.assertEqual(argmax, 1) + # Expect using at least 24+63+(size of an address) + 2*(2+63+(size of an address)) (=241) bytes. + model_allocation_bytes_used = int(backends_info["ai_onnxruntime_memory"]) + self.env.assertTrue(model_allocation_bytes_used >= 241) + self.env.assertEqual(int(backends_info["ai_onnxruntime_memory_access_num"]), self.allocator_access_counter) + 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. Overall, there should be no change in the memory consumption. + con.execute_command('AI.MODELEXECUTE', 'm{1}', 'INPUTS', 1, 'a_mul{1}', 'OUTPUTS', 1, 'b{1}') + self.allocator_access_counter += 6 + values = con.execute_command('AI.TENSORGET', 'b{1}', 'VALUES') + self.env.assertEqual(values, [b'1', b'4', b'9', b'16', b'25', b'36']) + backends_info = get_info_section(con, 'backends_info') + self.env.assertEqual(int(backends_info["ai_onnxruntime_memory_access_num"]), self.allocator_access_counter) + self.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}') + self.allocator_access_counter += 3 + self.env.assertFalse(con.execute_command('EXISTS', 'm{1}')) + backends_info = get_info_section(con, 'backends_info') + self.env.assertEqual(int(backends_info["ai_onnxruntime_memory"]), 0) + self.env.assertEqual(int(backends_info["ai_onnxruntime_memory_access_num"]), self.allocator_access_counter) -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 + def test_with_gpu(self): + if DEVICE == 'CPU': + self.env.debugPrint("skipping {} since this test if for GPU only".format(sys._getframe().f_code.co_name), force=True) + return + con = get_connection(self.env, '{1}') + model_pb = load_file_content('mul_1.onnx') - con = get_connection(env, '{1}') - model_pb = load_file_content('mul_1.onnx') + # for GPU, expect using the allocator only for allocating input and output names (not the model itself). + ret = con.execute_command('AI.MODELSTORE', 'm_gpu{1}', 'ONNX', DEVICE, 'BLOB', model_pb) + self.env.assertEqual(ret, b'OK') + self.allocator_access_counter += 2 - # 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') + # Expect using at least 2*(2+63+(size of an address))(=146) bytes by redis allocator, but no more than 240, + # as the model weights shouldn't be allocated by the allocator. + backends_info = get_info_section(con, 'backends_info') + model_allocation_bytes_used = int(backends_info["ai_onnxruntime_memory"]) + self.env.assertTrue(model_allocation_bytes_used > 146) + self.env.assertTrue(model_allocation_bytes_used < 241) + self.env.assertEqual(int(backends_info["ai_onnxruntime_memory_access_num"]), self.allocator_access_counter) + + # 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}') + self.allocator_access_counter += 4 + values = con.execute_command('AI.TENSORGET', 'b{1}', 'VALUES') + self.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') + self.env.assertEqual(int(backends_info["ai_onnxruntime_memory"]), model_allocation_bytes_used) + self.env.assertEqual(int(backends_info["ai_onnxruntime_memory_access_num"]), self.allocator_access_counter) - # 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 only 2 more accesses in delete - for deallocating input and output names + con.execute_command('AI.MODELDEL', 'm_gpu{1}') + self.allocator_access_counter += 2 + self.env.assertFalse(con.execute_command('EXISTS', 'm_gpu{1}')) + backends_info = get_info_section(con, 'backends_info') + self.env.assertEqual(int(backends_info["ai_onnxruntime_memory"]), 0) + self.env.assertEqual(int(backends_info["ai_onnxruntime_memory_access_num"]), self.allocator_access_counter) - # 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) + def test_memory_limit(self): + self.env = Env(moduleArgs='BACKEND_MEMORY_LIMIT 10 THREADS_PER_QUEUE 4') + self.allocator_access_counter = 0 + con = get_connection(self.env, '{1}') - # 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) + # Try to allocate a model whose size exceeds the memory limit + inception_pb = load_file_content('inception-v2-9.onnx') + x=input() + check_error_message(self.env, con, "Exception during initialization: Onnxruntime memory limit exceeded," + " memory allocation failed.", + 'AI.MODELSTORE', 'inception{1}', 'ONNX', 'CPU', 'BLOB', inception_pb) - # 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) + mnist_pb = load_file_content('mnist.onnx') + ret = con.execute_command('AI.MODELSTORE', 'mnist{1}', 'ONNX', 'CPU', 'BLOB', mnist_pb) + self.env.assertEqual(ret, b'OK') + x=input() class TestOnnxKillSwitch: @@ -542,7 +539,7 @@ def test_multiple_devices(self): str(len(devices)*self.threads_per_queue)) -def test_benchmark_allocator(): +def test_benchmark_allocator(env): return # currently disabled env = Env(moduleArgs='THREADS_PER_QUEUE 1') From ccf75b7f5904782c4ad55c3a65294481a65f5d3b Mon Sep 17 00:00:00 2001 From: alon Date: Mon, 4 Oct 2021 10:02:42 +0300 Subject: [PATCH 24/31] WIP - add tests for custom allocator --- tests/flow/tests_onnx.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/tests/flow/tests_onnx.py b/tests/flow/tests_onnx.py index 184494a8e..657a6f4da 100644 --- a/tests/flow/tests_onnx.py +++ b/tests/flow/tests_onnx.py @@ -455,21 +455,28 @@ def test_with_gpu(self): self.env.assertEqual(int(backends_info["ai_onnxruntime_memory_access_num"]), self.allocator_access_counter) def test_memory_limit(self): - self.env = Env(moduleArgs='BACKEND_MEMORY_LIMIT 10 THREADS_PER_QUEUE 4') + self.env = Env(moduleArgs='MODEL_EXECUTION_TIMEOUT 100000 BACKEND_MEMORY_LIMIT 1') self.allocator_access_counter = 0 con = get_connection(self.env, '{1}') # Try to allocate a model whose size exceeds the memory limit - inception_pb = load_file_content('inception-v2-9.onnx') + '''inception_pb = load_file_content('inception-v2-9.onnx') x=input() check_error_message(self.env, con, "Exception during initialization: Onnxruntime memory limit exceeded," " memory allocation failed.", - 'AI.MODELSTORE', 'inception{1}', 'ONNX', 'CPU', 'BLOB', inception_pb) + 'AI.MODELSTORE', 'inception{1}', 'ONNX', 'CPU', 'BLOB', inception_pb)''' mnist_pb = load_file_content('mnist.onnx') - ret = con.execute_command('AI.MODELSTORE', 'mnist{1}', 'ONNX', 'CPU', 'BLOB', mnist_pb) - self.env.assertEqual(ret, b'OK') - x=input() + sample_raw = load_file_content('one.raw') + for i in range(30): + ret = con.execute_command('AI.MODELSTORE', 'mnist{1}'+str(i), 'ONNX', 'CPU', 'BLOB', mnist_pb) + self.env.assertEqual(ret, b'OK') + con.execute_command('AI.TENSORSET', 'a{1}', 'FLOAT', 1, 1, 28, 28, 'BLOB', sample_raw) + + try: + ret = con.execute_command('AI.MODELEXECUTE', 'mnist{1}0', 'INPUTS', 1, 'a{1}', 'OUTPUTS', 1, 'b{1}') + except Exception as e: + print(str(e)) class TestOnnxKillSwitch: From 171119f8dbe27d179305897581389efbc9caa03a Mon Sep 17 00:00:00 2001 From: alon Date: Mon, 4 Oct 2021 13:03:24 +0300 Subject: [PATCH 25/31] WIP - add tests for custom allocator --- opt/redis_valgrind.sup | 8 +++++ .../onnx_allocator/onnx_allocator.cpp | 1 + src/backends/onnxruntime.c | 1 - tests/flow/tests_onnx.py | 32 +++++++++++++------ 4 files changed, 31 insertions(+), 11 deletions(-) diff --git a/opt/redis_valgrind.sup b/opt/redis_valgrind.sup index 8b00a448c..b38294595 100644 --- a/opt/redis_valgrind.sup +++ b/opt/redis_valgrind.sup @@ -26,6 +26,13 @@ obj:*/libtorch_cpu.so* } +{ + ignore_unversioned_libs + Memcheck:Overlap + ... + obj:*/libonnxruntime.so* +} + { ignore_unversioned_libs Memcheck:Leak @@ -168,3 +175,4 @@ fun:epoll_ctl ... } + diff --git a/src/backends/onnx_allocator/onnx_allocator.cpp b/src/backends/onnx_allocator/onnx_allocator.cpp index 56b0615d2..e318d4eaa 100644 --- a/src/backends/onnx_allocator/onnx_allocator.cpp +++ b/src/backends/onnx_allocator/onnx_allocator.cpp @@ -51,6 +51,7 @@ void* RAIOrtAllocator::Alloc(size_t size) { // that onnx made to the allocator. size_t cur_memory = memory_inuse.load(); if (memory_limit && cur_memory + allocated_size > memory_limit) { + RedisModule_Free(allocated_address); throw Ort::Exception("Onnxruntime memory limit exceeded, memory allocation failed.", ORT_RUNTIME_EXCEPTION); } memory_inuse.fetch_add(allocated_size); diff --git a/src/backends/onnxruntime.c b/src/backends/onnxruntime.c index ac8430c4c..6a83e0a0a 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 diff --git a/tests/flow/tests_onnx.py b/tests/flow/tests_onnx.py index 657a6f4da..9fc0178c2 100644 --- a/tests/flow/tests_onnx.py +++ b/tests/flow/tests_onnx.py @@ -455,28 +455,40 @@ def test_with_gpu(self): self.env.assertEqual(int(backends_info["ai_onnxruntime_memory_access_num"]), self.allocator_access_counter) def test_memory_limit(self): - self.env = Env(moduleArgs='MODEL_EXECUTION_TIMEOUT 100000 BACKEND_MEMORY_LIMIT 1') + self.env = Env(moduleArgs='THREADS_PER_QUEUE 8 BACKEND_MEMORY_LIMIT 1') self.allocator_access_counter = 0 con = get_connection(self.env, '{1}') # Try to allocate a model whose size exceeds the memory limit - '''inception_pb = load_file_content('inception-v2-9.onnx') - x=input() + inception_pb = load_file_content('inception-v2-9.onnx') check_error_message(self.env, con, "Exception during initialization: Onnxruntime memory limit exceeded," " memory allocation failed.", - 'AI.MODELSTORE', 'inception{1}', 'ONNX', 'CPU', 'BLOB', inception_pb)''' + 'AI.MODELSTORE', 'inception{1}', 'ONNX', 'CPU', 'BLOB', inception_pb) mnist_pb = load_file_content('mnist.onnx') sample_raw = load_file_content('one.raw') - for i in range(30): - ret = con.execute_command('AI.MODELSTORE', 'mnist{1}'+str(i), 'ONNX', 'CPU', 'BLOB', mnist_pb) + + # Create 25 different sessions of mnist model, the size of each session in onnx is ~31KB, overall ~770KB + for i in range(25): + ret = con.execute_command('AI.MODELSTORE', 'mnist_'+str(i)+'{1}', 'ONNX', 'CPU', 'BLOB', mnist_pb) self.env.assertEqual(ret, b'OK') con.execute_command('AI.TENSORSET', 'a{1}', 'FLOAT', 1, 1, 28, 28, 'BLOB', sample_raw) - try: - ret = con.execute_command('AI.MODELEXECUTE', 'mnist{1}0', 'INPUTS', 1, 'a{1}', 'OUTPUTS', 1, 'b{1}') - except Exception as e: - print(str(e)) + # As onnx memory consumption is about 0.77MB at this point, and executing mnist session requires an additional + # 500KB of memory, we are expected to exceed the memory limit here in a specific operation (the largest one). + check_error_message(self.env, con, "Non-zero status code returned while running Conv node." + " Name:'Convolution110' Status Message:" + " Onnxruntime memory limit exceeded, memory allocation failed.", + 'AI.MODELEXECUTE', 'mnist_0{1}', 'INPUTS', 1, 'a{1}', 'OUTPUTS', 1, 'b{1}') + + def run_parallel_onnx_sessions(con): + check_error_message(self.env, con, "Onnxruntime memory limit exceeded, memory allocation failed.", + 'AI.MODELEXECUTE', 'mnist_0{1}', 'INPUTS', 1, 'a{1}', 'OUTPUTS', 1, 'b{1}', + error_msg_is_substr=True) + + # We run sessions in parallel, all of them should fail. Note that here, we don't know for sure + # in which operation the execution would reach the memory limit, as the allocator is shared between the sessions + run_test_multiproc(self.env, '{1}', 50, run_parallel_onnx_sessions) class TestOnnxKillSwitch: From 134a8c125a3192e8af9a91554778ae85fb7c7706 Mon Sep 17 00:00:00 2001 From: alon Date: Mon, 4 Oct 2021 14:23:17 +0300 Subject: [PATCH 26/31] WIP - build onnxruntime 1.9.0 --- 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 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 From 6fa11ca912541350aba25f41302d025e54c029b6 Mon Sep 17 00:00:00 2001 From: alon Date: Tue, 5 Oct 2021 11:52:36 +0300 Subject: [PATCH 27/31] WIP - build onnxruntime 1.9 --- opt/build/dockerparts/apt.yml | 4 +--- opt/build/onnxruntime/dockerfile.tmpl | 8 ++++---- 2 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/dockerfile.tmpl b/opt/build/onnxruntime/dockerfile.tmpl index 2c19bb2f4..5805d1b7a 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' %} @@ -23,14 +23,14 @@ WORKDIR /build ARG BUILDTYPE=MinSizeRel ARG BUILDARGS="--use_cuda --cudnn_home /usr/local/cuda --cuda_home /usr/local/cuda" {% else %} -ARG BUILDTYPE=Release +ARG BUILDTYPE=MinSizeRel 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 -j4 +RUN git fetch --recurse-submodules RUN ./build.sh --config ${BUILDTYPE} ${BUILDARGS} --update --build --build_shared_lib --parallel # package From c52d579f664fb6ff2f121647256a13305343f63f Mon Sep 17 00:00:00 2001 From: alon Date: Wed, 6 Oct 2021 10:29:31 +0300 Subject: [PATCH 28/31] rename tests so thy will run in the desired order --- tests/flow/tests_onnx.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/flow/tests_onnx.py b/tests/flow/tests_onnx.py index 9fc0178c2..c465dd086 100644 --- a/tests/flow/tests_onnx.py +++ b/tests/flow/tests_onnx.py @@ -374,7 +374,7 @@ def __init__(self): return self.allocator_access_counter = 0 - def test_cpu_allocator(self): + def test_1_cpu_allocator(self): con = get_connection(self.env, '{1}') model_pb = load_file_content('mul_1.onnx') @@ -412,7 +412,7 @@ def test_cpu_allocator(self): self.env.assertEqual(int(backends_info["ai_onnxruntime_memory"]), 0) self.env.assertEqual(int(backends_info["ai_onnxruntime_memory_access_num"]), self.allocator_access_counter) - def test_with_gpu(self): + def test_2_with_gpu(self): if DEVICE == 'CPU': self.env.debugPrint("skipping {} since this test if for GPU only".format(sys._getframe().f_code.co_name), force=True) return @@ -454,7 +454,7 @@ def test_with_gpu(self): self.env.assertEqual(int(backends_info["ai_onnxruntime_memory"]), 0) self.env.assertEqual(int(backends_info["ai_onnxruntime_memory_access_num"]), self.allocator_access_counter) - def test_memory_limit(self): + def test_3_memory_limit(self): self.env = Env(moduleArgs='THREADS_PER_QUEUE 8 BACKEND_MEMORY_LIMIT 1') self.allocator_access_counter = 0 con = get_connection(self.env, '{1}') From e1a8d6f2f287c212d86d6c94d469b16e8f7a7f2e Mon Sep 17 00:00:00 2001 From: alon Date: Tue, 12 Oct 2021 12:35:48 +0300 Subject: [PATCH 29/31] minor changes --- src/backends/onnx_allocator/onnx_allocator.cpp | 4 ++-- src/config/config.c | 8 ++++---- src/redisai.c | 3 +-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/backends/onnx_allocator/onnx_allocator.cpp b/src/backends/onnx_allocator/onnx_allocator.cpp index e318d4eaa..432db4893 100644 --- a/src/backends/onnx_allocator/onnx_allocator.cpp +++ b/src/backends/onnx_allocator/onnx_allocator.cpp @@ -56,9 +56,9 @@ void* RAIOrtAllocator::Alloc(size_t size) { } memory_inuse.fetch_add(allocated_size); num_allocator_access.fetch_add(1); - // This operation guarantees that p2 is the closest 64-aligned address to (p1+size_t). + // This operation guarantees that "aligned_address" is the closest 64-aligned address to ("allocated_address"+size_t). void **aligned_address = (void **)(((size_t)(allocated_address) + offset) & (~63)); - // This stores the address p1 right before p2 (so we can retrieve it when we free). + // This stores the address "allocated_address" right before "aligned_address" (so we can retrieve it when we free). aligned_address[-1] = allocated_address; return aligned_address; } diff --git a/src/config/config.c b/src/config/config.c index 4b5fdca99..0a4e6a4e3 100644 --- a/src/config/config.c +++ b/src/config/config.c @@ -14,10 +14,10 @@ long long ModelChunkSize = 535822336; // size of chunks used to break up mo // default is 511 * 1024 * 1024 long long ThreadPoolSizePerQueue = 1; // Number of working threads for device. -long long ModelExecutionTimeout = 5000; // The maximum time in milliseconds - // before killing onnx run session. -long long BackendMemoryLimit = 0; // The maximum amount of memory in MB - // that backend is allowed to consume. +long long ModelExecutionTimeout = 5000; // The maximum time in milliseconds + // before killing onnx run session. +long long BackendMemoryLimit = 0; // The maximum amount of memory in MB + // that backend is allowed to consume. static int _Config_LoadTimeParamParse(RedisModuleCtx *ctx, const char *key, const char *val, RedisModuleString *rsval) { diff --git a/src/redisai.c b/src/redisai.c index 277b346ef..e3639aa66 100644 --- a/src/redisai.c +++ b/src/redisai.c @@ -1167,8 +1167,7 @@ void RAI_moduleInfoFunc(RedisModuleInfoCtx *ctx, int for_crash_report) { Config_GetBackendsIntraOpParallelism()); RedisModule_InfoAddFieldLongLong(ctx, "model_execution_timeout", Config_GetModelExecutionTimeout()); - RedisModule_InfoAddFieldLongLong(ctx, "backend_memory_limit", - Config_GetBackendMemoryLimit()); + RedisModule_InfoAddFieldLongLong(ctx, "backend_memory_limit", Config_GetBackendMemoryLimit()); _moduleInfo_getBackendsInfo(ctx); struct rusage self_ru, c_ru; From 86f6afec6653a4c43e4a150e3aa08bfdda7246c9 Mon Sep 17 00:00:00 2001 From: alon Date: Tue, 12 Oct 2021 12:46:14 +0300 Subject: [PATCH 30/31] small fixes from rebasing master --- opt/build/onnxruntime/pack.sh | 4 ++-- opt/redis_valgrind.sup | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/opt/build/onnxruntime/pack.sh b/opt/build/onnxruntime/pack.sh index a25d1c576..76df79999 100755 --- a/opt/build/onnxruntime/pack.sh +++ b/opt/build/onnxruntime/pack.sh @@ -30,5 +30,5 @@ cp onnxruntime/include/onnxruntime/core/providers/cpu/cpu_provider_factory.h pac 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}/ diff --git a/opt/redis_valgrind.sup b/opt/redis_valgrind.sup index b38294595..d509b2e38 100644 --- a/opt/redis_valgrind.sup +++ b/opt/redis_valgrind.sup @@ -175,4 +175,3 @@ fun:epoll_ctl ... } - From 1e874ddb66ea7791d56b296e68b088f08652254e Mon Sep 17 00:00:00 2001 From: alon Date: Tue, 12 Oct 2021 12:46:14 +0300 Subject: [PATCH 31/31] Fix error message assertion in test (due to difference in the exact memory consumption between jemalloc and libc allocators) + remove bert model that served for benchmark only --- opt/build/onnxruntime/pack.sh | 4 ++-- opt/redis_valgrind.sup | 1 - tests/flow/test_data/bert-base-cased.onnx | 3 --- tests/flow/tests_onnx.py | 13 ++++++------- 4 files changed, 8 insertions(+), 13 deletions(-) delete mode 100644 tests/flow/test_data/bert-base-cased.onnx diff --git a/opt/build/onnxruntime/pack.sh b/opt/build/onnxruntime/pack.sh index a25d1c576..76df79999 100755 --- a/opt/build/onnxruntime/pack.sh +++ b/opt/build/onnxruntime/pack.sh @@ -30,5 +30,5 @@ cp onnxruntime/include/onnxruntime/core/providers/cpu/cpu_provider_factory.h pac 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}/ diff --git a/opt/redis_valgrind.sup b/opt/redis_valgrind.sup index b38294595..d509b2e38 100644 --- a/opt/redis_valgrind.sup +++ b/opt/redis_valgrind.sup @@ -175,4 +175,3 @@ fun:epoll_ctl ... } - diff --git a/tests/flow/test_data/bert-base-cased.onnx b/tests/flow/test_data/bert-base-cased.onnx deleted file mode 100644 index 17c5e8182..000000000 --- a/tests/flow/test_data/bert-base-cased.onnx +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c8b29b06415e08f3d0de97e47ec94ccd6ce6ed52cef0cc1202bb13b3cdff4d45 -size 433311846 diff --git a/tests/flow/tests_onnx.py b/tests/flow/tests_onnx.py index eac34332c..f79bb3e9b 100644 --- a/tests/flow/tests_onnx.py +++ b/tests/flow/tests_onnx.py @@ -473,19 +473,18 @@ def test_3_memory_limit(self): con.execute_command('AI.TENSORSET', 'a{1}', 'FLOAT', 1, 1, 28, 28, 'BLOB', sample_raw) # As onnx memory consumption is about 0.77MB at this point, and executing mnist session requires an additional - # 500KB of memory, we are expected to exceed the memory limit here in a specific operation (the largest one). - check_error_message(self.env, con, "Non-zero status code returned while running Conv node." - " Name:'Convolution110' Status Message:" - " Onnxruntime memory limit exceeded, memory allocation failed.", - 'AI.MODELEXECUTE', 'mnist_0{1}', 'INPUTS', 1, 'a{1}', 'OUTPUTS', 1, 'b{1}') + # 500KB of memory, we are expected to exceed the memory limit here in some operation. Note that the exact + # memory consumption here changes whether we are using libc allocator or jemalloc (jemalloc will be greater) + check_error_message(self.env, con, "Onnxruntime memory limit exceeded, memory allocation failed.", + 'AI.MODELEXECUTE', 'mnist_0{1}', 'INPUTS', 1, 'a{1}', 'OUTPUTS', 1, 'b{1}', + error_msg_is_substr=True) def run_parallel_onnx_sessions(con): check_error_message(self.env, con, "Onnxruntime memory limit exceeded, memory allocation failed.", 'AI.MODELEXECUTE', 'mnist_0{1}', 'INPUTS', 1, 'a{1}', 'OUTPUTS', 1, 'b{1}', error_msg_is_substr=True) - # We run sessions in parallel, all of them should fail. Note that here, we don't know for sure - # in which operation the execution would reach the memory limit, as the allocator is shared between the sessions + # We run sessions in parallel, all of them should fail. Note that here. run_test_multiproc(self.env, '{1}', 50, run_parallel_onnx_sessions)