Skip to content

Commit b04ec83

Browse files
authored
Upgrade to onnx 1.9 (#847)
Upgrade python in xenial docker to 3.7 from 3.6 and gcc version to 7 Build onnx with DISABLE_EXTERNAL_INITIALIZERS flag for both CPU and GPU Update deps cache key in CI Ignore overlap valgrind errors from onnx lib that was introduced in 1.9.0
1 parent 3e8d7a1 commit b04ec83

21 files changed

+268
-1920
lines changed

.circleci/config.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ commands:
101101
- checkout-all
102102
- restore_cache:
103103
keys:
104-
- v1-dependencies-{{ checksum "get_deps.sh" }}-cpu
104+
- v1.2.5-deps-{{ checksum "get_deps.sh" }}-cpu
105105
# If no exact match is found will get dependencies from source
106106
- setup-build-system
107107
- run:
@@ -112,7 +112,7 @@ commands:
112112
- save_cache:
113113
paths:
114114
- deps
115-
key: v1-dependencies-{{ checksum "get_deps.sh" }}-cpu
115+
key: v1.2.5-deps-{{ checksum "get_deps.sh" }}-cpu
116116
- run:
117117
name: Build
118118
command: make -C opt all SHOW=1
@@ -151,7 +151,7 @@ commands:
151151
- checkout-all
152152
- restore_cache:
153153
keys:
154-
- v1-dependencies-{{ checksum "get_deps.sh" }}-cpu
154+
- v1.2.5-deps-{{ checksum "get_deps.sh" }}-cpu
155155
# If no exact match is found will get dependencies from source
156156
- setup-build-system
157157
- run:
@@ -178,7 +178,7 @@ commands:
178178
- checkout-all
179179
- restore_cache:
180180
keys:
181-
- v1-dependencies-{{ checksum "get_deps.sh" }}-gpu
181+
- v1.2.5-deps-{{ checksum "get_deps.sh" }}-gpu
182182
- relocate-docker-storage
183183
- run:
184184
name: Build
@@ -189,7 +189,7 @@ commands:
189189
- save_cache:
190190
paths:
191191
- deps
192-
key: v1-dependencies-{{ checksum "get_deps.sh" }}-gpu
192+
key: v1.2.5-deps-{{ checksum "get_deps.sh" }}-gpu
193193
- run:
194194
name: Test
195195
command: |
@@ -239,7 +239,7 @@ jobs:
239239
- checkout-all
240240
- restore_cache:
241241
keys:
242-
- v1-dependencies-{{ checksum "get_deps.sh" }}-<<parameters.osnick>>-<<parameters.target>>
242+
- v1.2.5-deps-{{ checksum "get_deps.sh" }}-<<parameters.osnick>>-<<parameters.target>>
243243
- setup-automation
244244

245245
# since we run in parallel, we need to generate docker files with different suffixes hence the DOCKER_SUFFIX
@@ -260,7 +260,7 @@ jobs:
260260
- save_cache:
261261
paths:
262262
- deps
263-
key: v1-dependencies-{{ checksum "get_deps.sh" }}-<<parameters.osnick>>-<<parameters.target>>
263+
key: v1.2.5-deps-{{ checksum "get_deps.sh" }}-<<parameters.osnick>>-<<parameters.target>>
264264
- persist_to_workspace:
265265
root: bin/
266266
paths:
@@ -275,7 +275,7 @@ jobs:
275275
- checkout-all
276276
- restore_cache:
277277
keys:
278-
- v1-dependencies-{{ checksum "get_deps.sh" }}-cpu
278+
- v1.2.5-deps-{{ checksum "get_deps.sh" }}-cpu
279279
# If no exact match is found will get dependencies from source
280280
- setup-build-system
281281
- run:
@@ -309,7 +309,7 @@ jobs:
309309
- checkout-all
310310
- restore_cache:
311311
keys:
312-
- v1-dependencies-{{ checksum "get_deps.sh" }}-cpu
312+
- v1.2.5-deps-{{ checksum "get_deps.sh" }}-cpu
313313
# If no exact match is found will get dependencies from source
314314
- setup-build-system
315315
- run:

docs/developer-backends.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# RedisAI Development Backends
2+
3+
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.
4+
5+
To follow these instructions, this repository must be cloned with all of its submodules (i.e *git clone --recursive https://github.com/redisai/redisai*)
6+
7+
GNU Make is used as a runner for the dockerfile generator. Python is the language used for the generator script, and jinja is the templating library used to create the docker file from a template *dockerfile.tmpl* that can be found in the directory of a given backend listed below.
8+
9+
## Tools
10+
11+
Building the backends requires installation of the following tools:
12+
13+
1. gnu make
14+
1. python (3.0 or higher)
15+
1. docker
16+
1. jinja2
17+
18+
On ubuntu bionic these can be installed by running the following steps, to install python3, create a virtual environment, and install the jinja templating dependency. Replace */path/to/venv* with your desired virtualenv location.
19+
20+
```
21+
sudo apt install python3 python3-dev make docker
22+
python3 -m venv /path/to/venv
23+
source /path/to/venv/bin/activate
24+
pip install jinja
25+
```
26+
27+
-------
28+
29+
## Backends
30+
31+
### onnxruntime
32+
33+
We build Onnxruntime library with DISABLE_EXTERNAL_INITIALIZERS=ON build flag. This means that loading ONNX models that use external files to store the initial (usually very large) values of the model's operations, is invalid. That is, initializers values must be part of the serialized model, which is also the standard use case.
34+
35+
**Compilation target devices:**
36+
37+
1. x86\_64 bit linux systems
38+
39+
1. x86\_64 bit linux systems with a GPU
40+
41+
**Directory:** opt/build/onnxruntime
42+
43+
**Build options:**
44+
45+
1. To build run *make*
46+
47+
1. To build with GPU support on x86\_64 run *make GPU=1*

docs/developer.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ sudo ./opt/system-setup.py
172172

173173
To compile RedisAI, run *make -C opt all*, from the root of the repository.
174174

175+
Build the backends is described in [this document](developer-backends.md).
176+
175177
### Testing
176178

177179
**Running Tests**

get_deps.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ fi
289289

290290
################################################################################### ONNXRUNTIME
291291

292-
ORT_VERSION="1.7.1"
292+
ORT_VERSION="1.9.0"
293293

294294
if [[ $WITH_ORT != 0 ]]; then
295295
[[ $FORCE == 1 ]] && rm -rf $ONNXRUNTIME

opt/build/backends.rules

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# PRODUCT var is the backend name, without any other configuration (set in each backend's corresponding makefile)
2+
3+
# default is x64
4+
ARCH=$(shell ${READIES}/bin/platform --arch)
5+
OS=$(shell ${READIES}/bin/platform --os)
6+
REDIS_CMAKE_ARCH=x86_64
7+
DOCKER_ORG=redislabs
8+
9+
# jetson
10+
ifeq ($(shell test -e /usr/share/doc/nvidia-l4t-jetson-io && echo -n yes),yes)
11+
ARCH=jetson
12+
REDIS_CMAKE_ARCH=aarch64
13+
GPU=1
14+
endif
15+
export REDIS_CMAKE_ARCH
16+
17+
# override if necessary in top-level make files
18+
DEFAULT_DOCKER_TAG=${DOCKER_ORG}/${PRODUCT}:build
19+
CIDFILE=${PRODUCT}.${ARCH}.cid
20+
21+
ifeq ($(GPU),1)
22+
REDIS_GPU=1
23+
VARIANT=gpu
24+
CIDFILE=${PRODUCT}.${ARCH}.gpu.cid # this way we can build from the same tree across platforms
25+
export REDIS_GPU
26+
endif
27+
28+
ifeq ($(VARIANT),)
29+
BACKEND_NAME=${PRODUCT}-${OS}-${ARCH}-${VERSION}.tgz
30+
else
31+
BACKEND_NAME=${PRODUCT}-${OS}-${ARCH}-${VARIANT}-${VERSION}.tgz
32+
endif
33+
34+
S3_URL=redismodules/${PRODUCT}
35+
36+
build:
37+
@rm -f ${BACKEND_NAME} *.cid
38+
REDIS_ARCH=${ARCH} \
39+
REDIS_OSNICK=${OSNICK} \
40+
${READIES}/bin/dockerwrapper \
41+
-d ${CURDIR}/Dockerfile${DOCKER_SUFFIX} \
42+
-t ${DEFAULT_DOCKER_TAG} \
43+
-S ../dockerparts \
44+
-e REDIS \
45+
-D "${DOCKER_OPTS}" \
46+
${DOCKER_ARGS}
47+
docker create --cidfile ${CIDFILE} ${DEFAULT_DOCKER_TAG}
48+
docker cp `cat ${CIDFILE}`:/build/${BACKEND_NAME} .
49+
50+
publish:
51+
@aws s3 cp ${BACKEND_NAME} s3://$(S3_URL)/ --acl public-read
52+
53+
# ---------------------------------------------------------------------------------------------------
54+
define HELP
55+
make build> # build the backend, tagging the docker image so that the files can be copied out of it
56+
OSNICK=<> # optional base operating system (xenial, bionic, etc)
57+
REDIS_CUDA_VERSION=<> # optional cuda version to override
58+
DOCKER_SUFFIX=<> # optional suffix for the generated dockerfile
59+
GPU=1 # if set, build the GPU
60+
make publish > # upload the generated artifacts to s3 same
61+
GPU=1 # if set, upload the GPU artifact (defaults to cpu)
62+
endef
63+
# ---------------------------------------------------------------------------------------------------
64+
include ${READIES}/mk/help.defs
65+
include ${READIES}/mk/help.rules

opt/build/dockerparts/apt.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
RUN apt-get update -qq
2+
RUN DEBIAN_NONINTERACTIVE=y1 apt-get install -y software-properties-common
3+
4+
{% if REDIS_OSNICK == 'xenial' %}
5+
RUN add-apt-repository ppa:deadsnakes/ppa
6+
RUN add-apt-repository ppa:ubuntu-toolchain-r/test
7+
{% endif %}
8+
9+
RUN apt-get update -qq
10+
RUN DEBIAN_NONINTERACTIVE=1 apt-get install -y curl wget tar git patch \
11+
build-essential libcurl4-openssl-dev libssl-dev libatlas-base-dev zlib1g-dev \
12+
python3.7 python3-pip python3-dev python3-numpy \
13+
gcc-7 g++-7
14+
15+
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 60
16+
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 --slave /usr/bin/g++ g++ /usr/bin/g++-7
17+
18+
RUN python3 -m pip install --upgrade pip setuptools wheel
19+
20+
ENV LANG=en_US.UTF-8
21+
RUN apt-get install -y locales && \
22+
sed -i -e "s/# $LANG.*/$LANG UTF-8/" /etc/locale.gen && \
23+
dpkg-reconfigure --frontend=noninteractive locales && \
24+
update-locale LANG=$LANG
25+
26+

opt/build/dockerparts/cmake.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{% set cmake_version = "3.19.7" %}
2+
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
3+
4+
WORKDIR /tmp
5+
RUN tar -zxpf /tmp/cmake.tgz
6+
RUN mv /tmp/cmake*/bin/* /usr/bin
7+
RUN mv /tmp/cmake-*/share/cmake* /usr/share/
8+
9+

opt/build/onnxruntime/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Dockerfile
2+
onnxruntime.x64.cid

opt/build/onnxruntime/Dockerfile.arm

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

opt/build/onnxruntime/Dockerfile.arm7

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

0 commit comments

Comments
 (0)