Skip to content

Commit eb1158c

Browse files
committed
Remove unused build logic, update documentation
1 parent 5165eaf commit eb1158c

File tree

4 files changed

+28
-116
lines changed

4 files changed

+28
-116
lines changed

docs/developer-backends.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
# RedisAI Development Backends
22

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.
3+
This document describes how ONNXRuntime backend can be built from this repository.
4+
We build ONNXRuntime library with DISABLE_EXTERNAL_INITIALIZERS=ON build flag, which is not the default configuration. This means that loading ONNX models that use external files to store the initial (usually very large) values of the model's operations, is invalid. That is, initializers values must be part of the serialized model, which is also the standard use case.
5+
6+
It is compiled in a docker, which is responsible for the configuration and installation of all tools required the build process.
47

58
To follow these instructions, this repository must be cloned with all of its submodules (i.e *git clone --recursive https://github.com/redisai/redisai*)
69

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.
10+
GNU Make is used as a runner for the dockerfile generator. Python is the language used for the generator script, and jinja is the templating library used to create the docker file from a template *dockerfile.tmpl* that can be found in the `/opt/build/onnxruntime` directory.
811

9-
## Tools
12+
### Tools
1013

11-
Building the backends requires installation of the following tools:
14+
Building the backend requires installation of the following tools:
1215

1316
1. gnu make
1417
1. python (3.0 or higher)
@@ -26,12 +29,6 @@ pip install jinja
2629

2730
-------
2831

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-
3532
**Compilation target devices:**
3633

3734
1. x86\_64 bit linux systems

docs/developer.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,16 @@ sudo ./opt/system-setup.py
170170

171171
**Building**
172172

173-
To compile RedisAI, run *make -C opt all*, from the root of the repository.
173+
Before compiling RedisAI module, make sure that you have the backends' shared libraries in the `deps` directory. These can be easily obtained by running:
174+
```./get_deps```
175+
or
176+
```./get_deps gpu```
177+
for having GPU support.
178+
Except for ONNXRuntime backend which is stored in a S3 bucket, other backends' binary files are downloaded directly from their official websites.
179+
Further details about building ONNXRuntime backend for RedisAI is described in [this document](developer-backends.md).
180+
181+
To compile RedisAI, run `make -C opt` or `make -C opt GPU=1`, from the root of the repository. This will create the module's shared library `redisai.so` in `instali-cpu`/`install-gpu` directory respectively.
174182

175-
Build the backends is described in [this document](developer-backends.md).
176183

177184
### Testing
178185

get_deps.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ if [[ $1 == --help || $1 == help ]]; then
2929
VERBOSE=1 Print commands
3030
FORCE=1 Download even if present
3131
WITH_DLPACK=0 Skip dlpack
32-
WITH_TF=0 Skip Tensorflow or download from S3 repo
33-
WITH_TFLITE=0 Skip TensorflowLite or download from S3 repo
34-
WITH_PT=0 Skip PyTorch or download from S3 repo
32+
WITH_TF=0 Skip Tensorflow or download official version
33+
WITH_TFLITE=0 Skip TensorflowLite or download official version
34+
WITH_PT=0 Skip PyTorch or download official version
3535
WITH_ORT=0 Skip OnnxRuntime or download from S3 repo
3636
OS= Set, to override the platform OS
3737
ARCH=0 Set, to override the platform ARCH
@@ -99,17 +99,17 @@ clean_and_fetch() {
9999
echo "Done."
100100
}
101101

102-
# This is fot torch backend, which comes in a zip file
102+
# This is foר torch backend, which comes in a zip file
103103
clean_and_fetch_torch() {
104104
archive=$1
105105
src_url=$2
106106

107-
[[ $FORCE == 1 ]] && rm -rf ${product} # FORCE is from the env
108-
[[ $FORCE != 1 ]] && [[ -d ${product} ]] && echo "${product} is in place, skipping. Set FORCE=1 to override. Continuing." && return
109-
echo "Installing ${product} from ${src_url} in `pwd`..."
110-
111-
wget -q -O archive src_url
112-
107+
[[ $FORCE == 1 ]] && rm -rf libtorch # FORCE is from the env
108+
[[ $FORCE != 1 ]] && [[ -d libtorch ]] && echo "libtorch is in place, skipping. Set FORCE=1 to override. Continuing." && return
109+
echo "Installing libtorch from ${src_url} in `pwd`..."
110+
LIBTORCH_ZIP=libtorch-${DEVICE}-${PT_VERSION}.zip
111+
wget -q -O ${LIBTORCH_ZIP} ${src_url}
112+
unzip -q -o ${LIBTORCH_ZIP}
113113
}
114114

115115

@@ -181,14 +181,13 @@ fi # WITH_TFLITE
181181
####################################################################################### LIBTORCH
182182

183183
PT_BUILD=cpu
184-
PT_ARCH=x86_64
185184
if [[ $OS == linux ]]; then
186185
PT_OS=linux
187186
if [[ $GPU == 1 ]]; then
188187
PT_BUILD=cu111
189188
fi
190189
if [[ $ARCH == x64 ]]; then
191-
PT_REPACK=1
190+
PT_ARCH=x86_64
192191
else
193192
echo "Only x64 is supported currently"
194193
fi
@@ -225,6 +224,7 @@ if [[ $OS == linux ]]; then
225224
fi
226225
else
227226
echo "Only Linux OS is supported currently"
227+
fi
228228

229229
ORT_ARCHIVE=onnxruntime-${ORT_OS}-${ORT_ARCH}${ORT_BUILD}-${ORT_VERSION}.tgz
230230
if [[ $WITH_ORT != 0 ]]; then

opt/build/libtorch/repack.sh

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

0 commit comments

Comments
 (0)