Skip to content

onnxruntime 1.7.2 build and documentation #785

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 15 commits into from
Closed
46 changes: 46 additions & 0 deletions docs/developer-backends.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# 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

**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=<yoursuffix>* 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
2 changes: 2 additions & 0 deletions docs/developer.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,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**
Expand Down
2 changes: 1 addition & 1 deletion get_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ fi

################################################################################### ONNXRUNTIME

ORT_VERSION="1.7.1"
ORT_VERSION="1.7.2"

if [[ $WITH_ORT != 0 ]]; then
[[ $FORCE == 1 ]] && rm -rf $ONNXRUNTIME
Expand Down
48 changes: 48 additions & 0 deletions opt/build/backends.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# default is x64
ARCH=$(shell ${READIES}/bin/platform --arch)
OS=$(shell ${READIES}/bin/platform --os)
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
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

ifeq ($(GPU),1)
REDIS_GPU=1
VARIANT=gpu
CIDFILE=${PRODUCT}.${ARCH}.gpu.cid # this way we can build from the same tree across platforms
export REDIS_GPU
endif

ifeq ($(VARIANT),)
BACKEND_NAME=${PRODUCT}-${OS}-${ARCH}-${REDIS_BACKEND_VERSION}.tgz
else
BACKEND_NAME=${PRODUCT}-${OS}-${ARCH}-${VARIANT}-${REDIS_BACKEND_VERSION}.tgz
endif

S3_URL=redismodules/${PRODUCT}

build:
@rm -f ${BACKEND_NAME} *.cid
REDIS_ARCH=${ARCH} \
VERSION=${VERSION} \
${READIES}/bin/dockerwrapper \
-d ${CURDIR}/Dockerfile${DOCKER_SUFFIX} \
-t ${DEFAULT_DOCKER_TAG} \
-S ../dockerparts \
-e REDIS \
-D "${DOCKER_OPTS}" \
${DOCKER_ARGS}
docker create --cidfile ${CIDFILE} ${DEFAULT_DOCKER_TAG}
docker cp `cat ${CIDFILE}`:/build/${PRODUCT}/${BACKEND_NAME} .

publish:
@aws s3 cp ${BACKEND_NAME} s3://$(S3_URL)/ --acl public-read
16 changes: 16 additions & 0 deletions opt/build/dockerparts/apt.yml
Original file line number Diff line number Diff line change
@@ -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


9 changes: 9 additions & 0 deletions opt/build/dockerparts/cmake.yml
Original file line number Diff line number Diff line change
@@ -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/


2 changes: 2 additions & 0 deletions opt/build/onnxruntime/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Dockerfile
onnxruntime.x64.cid
53 changes: 0 additions & 53 deletions opt/build/onnxruntime/Dockerfile.arm

This file was deleted.

47 changes: 0 additions & 47 deletions opt/build/onnxruntime/Dockerfile.arm7

This file was deleted.

45 changes: 0 additions & 45 deletions opt/build/onnxruntime/Dockerfile.x64

This file was deleted.

Loading