Skip to content

Commit 411f68f

Browse files
author
DvirDukhan
authored
Merge branch 'master' into torchscript_extensions
2 parents 13dfd20 + a191e32 commit 411f68f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+3095
-1879
lines changed

.circleci/config.yml

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ commands:
1212
- setup_remote_docker:
1313
docker_layer_caching: true
1414

15+
setup-automation:
16+
steps:
17+
- run:
18+
name: Setup automation
19+
command: |
20+
PIP=1 ./opt/readies/bin/getpy3
21+
./opt/system-setup.py
22+
1523
build-steps:
1624
parameters:
1725
platform:
@@ -25,11 +33,10 @@ commands:
2533
keys:
2634
- v1-dependencies-{{ checksum "get_deps.sh" }}
2735
# If no exact match is found will get dependencies from source
36+
- setup-automation
2837
- run:
2938
name: Install dependencies
3039
command: |
31-
./opt/readies/bin/getpy3
32-
BREW_NO_UPDATE=1 ./opt/system-setup.py
3340
./opt/readies/bin/getredis -v 6 --force
3441
./get_deps.sh cpu
3542
- save_cache:
@@ -60,8 +67,6 @@ commands:
6067
- artifacts/*.zip
6168
- artifacts/*.tgz
6269
- artifacts/*.tar
63-
# - artifacts/shapshots/*.zip
64-
# - artifacts/shapshots/*.tgz
6570
- store_artifacts:
6671
path: tests/logs
6772

@@ -98,8 +103,6 @@ commands:
98103
- artifacts/*.zip
99104
- artifacts/*.tgz
100105
- artifacts/*.tar
101-
# - artifacts/shapshots/*.zip
102-
# - artifacts/shapshots/*.tgz
103106
- store_artifacts:
104107
path: test/logs
105108

@@ -156,11 +159,10 @@ jobs:
156159
keys:
157160
- build-dependencies-{{ checksum "get_deps.sh" }}
158161
# If no exact match is found will get dependencies from source
162+
- setup-automation
159163
- run:
160164
name: Install dependencies
161165
command: |
162-
./opt/readies/bin/getpy3
163-
./opt/system-setup.py
164166
./opt/readies/bin/getredis -v 6 --valgrind --force
165167
./get_deps.sh cpu
166168
- run:
@@ -174,6 +176,34 @@ jobs:
174176
make -C opt cov-upload
175177
no_output_timeout: 30m
176178

179+
valgrind:
180+
docker:
181+
- image: redisfab/rmbuilder:6.0.5-x64-buster
182+
steps:
183+
- checkout
184+
- run:
185+
name: Submodule checkout
186+
command: git submodule update --init --recursive
187+
- restore_cache:
188+
keys:
189+
- build-dependencies-{{ checksum "get_deps.sh" }}
190+
# If no exact match is found will get dependencies from source
191+
- setup-automation
192+
- run:
193+
name: Install dependencies
194+
command: |
195+
./opt/readies/bin/getredis -v 6 --valgrind --force
196+
./get_deps.sh cpu
197+
- run:
198+
name: Build for valgrind
199+
command: |
200+
make -C opt all VALGRIND=1 SHOW=1
201+
- run:
202+
name: Test with valgrind
203+
command: |
204+
make -C opt test VALGRIND=1
205+
no_output_timeout: 120m
206+
177207
build-macos:
178208
macos:
179209
xcode: 11.3.0
@@ -322,7 +352,6 @@ on-master-and-version-tags: &on-master-and-version-tags
322352
tags:
323353
only: /^v[0-9].*/
324354

325-
326355
platform-build-defs: &platform-build-defs
327356
requires:
328357
- build-debian
@@ -362,6 +391,9 @@ workflows:
362391
- coverage:
363392
<<: *on-any-branch
364393
<<: *after-linter
394+
- valgrind:
395+
<<: *on-master
396+
<<: *after-linter
365397
- build-and-test-gpu:
366398
<<: *on-any-branch
367399
<<: *after-linter

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/bin/
22
/deps/
3+
/docs/
34
/install*
45
/build/
56
.venv/

Dockerfile.jetson

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# BUILD redisfab/redisai:${VERSION}-jetson-${ARCH}-${OSNICK}
2+
3+
ARG REDIS_VER=6.0.9
4+
5+
# OSNICK=bionic|centos7|centos6
6+
ARG OSNICK=bionic
7+
8+
# OS=ubuntu18.04|ubuntu16.04|centos7
9+
ARG OS=ubuntu18.04
10+
11+
# ARCH=arm64v8|arm32v7
12+
ARG ARCH=arm64v8
13+
14+
ARG CUDA_VER=10.2-cudnn7
15+
16+
ARG L4T_VER=r32.4.4
17+
18+
ARG PACK=0
19+
ARG TEST=0
20+
21+
#----------------------------------------------------------------------------------------------
22+
FROM redisfab/redis:${REDIS_VER}-${ARCH}-${OSNICK} AS redis
23+
FROM redisfab/jetpack:4.4.1-arm64v8-l4t as builder
24+
25+
ARG OSNICK
26+
ARG OS
27+
ARG ARCH
28+
ARG REDIS_VER
29+
ARG CUDA_VER
30+
ARG L4T_VER
31+
32+
RUN echo "Building for ${OSNICK} (${OS}) for ${ARCH} [with Redis ${REDIS_VER}]"
33+
34+
ENV NVIDIA_VISIBLE_DEVICES all
35+
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility
36+
37+
WORKDIR /build
38+
COPY --from=redis /usr/local/ /usr/local/
39+
40+
COPY ./opt/ opt/
41+
COPY ./tests/flow/test_requirements.txt tests/flow/
42+
43+
RUN PIP=1 FORCE=1 ./opt/readies/bin/getpy3
44+
RUN ./opt/system-setup.py
45+
46+
ARG DEPS_ARGS="GPU=1 JETSON=1 WITH_PT=1 WITH_TF=1 WITH_TFLITE=0 WITH_ORT=0"
47+
COPY ./get_deps.sh .
48+
# RUN if [ "$DEPS_ARGS" = "" ]; then ./get_deps.sh gpu; else env $DEPS_ARGS ./get_deps.sh gpu; fi
49+
RUN set -e ;\
50+
env $DEPS_ARGS ./get_deps.sh
51+
52+
ARG BUILD_ARGS="GPU=1 JETSON=1 WITH_TF=1 WITH_PT=1 WITH_TFLITE=0 WITH_ORT=0"
53+
54+
ADD ./ /build
55+
RUN bash -c "set -e ;\
56+
. ./opt/readies/bin/sourced ./profile.d ;\
57+
make -C opt build $BUILD_ARGS SHOW=1"
58+
59+
ARG PACK
60+
ARG TEST
61+
62+
RUN mkdir -p bin/artifacts
63+
RUN set -e ;\
64+
if [ "$PACK" = "1" ]; then make -C opt pack GPU=1; fi
65+
66+
RUN set -e ;\
67+
if [ "$TEST" = "1" ]; then \
68+
TEST= make -C opt test GPU=1 $BUILD_ARGS NO_LFS=1 ;\
69+
if [[ -d test/logs ]]; then \
70+
tar -C test/logs -czf bin/artifacts/test-logs-gpu.tgz . ;\
71+
fi ;\
72+
fi
73+
74+
#----------------------------------------------------------------------------------------------
75+
# FROM nvidia/cuda:${CUDA_VER}-runtime-${OS}
76+
# FROM nvidia/cuda-arm64:11.1-runtime-ubuntu18.04
77+
# FROM nvcr.io/nvidia/l4t-base:${L4T_VER}
78+
FROM redisfab/jetpack:4.4.1-arm64v8-l4t
79+
80+
ARG OS
81+
ARG L4T_VER
82+
83+
RUN if [ ! -z $(command -v apt-get) ]; then apt-get -qq update; apt-get -q install -y libgomp1; fi
84+
RUN if [ ! -z $(command -v yum) ]; then yum install -y libgomp; fi
85+
86+
ENV REDIS_MODULES /usr/lib/redis/modules
87+
RUN mkdir -p $REDIS_MODULES/
88+
89+
COPY --from=redis /usr/local/ /usr/local/
90+
COPY --from=builder /build/install-gpu/ $REDIS_MODULES/
91+
92+
COPY --from=builder /build/bin/artifacts/ /var/opt/redislabs/artifacts
93+
94+
# COPY --from=builder /usr/local/etc/redis/redis.conf /usr/local/etc/redis/
95+
96+
WORKDIR /data
97+
EXPOSE 6379
98+
# CMD ["/usr/local/bin/redis-server", "/usr/local/etc/redis/redis.conf", "--loadmodule", "/usr/lib/redis/modules/redisai.so"]
99+
CMD ["/usr/local/bin/redis-server", "--loadmodule", "/usr/lib/redis/modules/redisai.so"]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ RedisAI currently supports PyTorch (libtorch), Tensorflow (libtensorflow), Tenso
136136
| 0.4.0 | 1.2.0 | 1.14.0 | None | 0.5.0 |
137137
| 0.9.0 | 1.3.1 | 1.14.0 | 2.0.0 | 1.0.0 |
138138
| 1.0.0 | 1.5.0 | 1.15.0 | 2.0.0 | 1.2.0 |
139-
| master | 1.5.0 | 1.15.0 | 2.0.0 | 1.2.0 |
139+
| master | 1.7.0 | 1.15.0 | 2.0.0 | 1.2.0 |
140140

141141
Note: Keras and TensorFlow 2.x are supported through graph freezing. See [this script](https://github.com/RedisAI/RedisAI/blob/master/tests/test_data/tf2-minimal.py) to see how to export a frozen graph from Keras and TensorFlow 2.x. Note that a frozen graph will be executed using the TensorFlow 1.15 backend. Should any 2.0 ops be not supported on the 1.15 after freezing, please open an Issue.
142142

@@ -152,4 +152,4 @@ Got questions? Feel free to ask at the [RedisAI Forum](https://forum.redislabs.c
152152

153153
Redis Source Available License Agreement - see [LICENSE](LICENSE)
154154

155-
Copyright 2020, [Tensorwerk, Inc](https://tensorwerk.com) & [Redis Labs, Inc](https://redislabs.com)
155+
Copyright 2020, [Redis Labs, Inc](https://redislabs.com)

get_deps.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ if [[ $1 == --help || $1 == help ]]; then
1616
Argument variables:
1717
CPU=1 Get CPU dependencies
1818
GPU=1 Get GPU dependencies
19+
JETSON=1 Get Jetson Nano dependencies
1920
VERBOSE=1 Print commands
2021
FORCE=1 Download even if present
2122
WITH_DLPACK=0 Skip dlpack
@@ -106,6 +107,9 @@ if [[ $WITH_TF != 0 ]]; then
106107
LIBTF_URL_BASE=https://storage.googleapis.com/tensorflow/libtensorflow
107108
elif [[ $ARCH == arm64v8 ]]; then
108109
TF_ARCH=arm64
110+
if [[ $JETSON == 1 ]]; then
111+
TF_BUILD="gpu-jetson"
112+
fi
109113
LIBTF_URL_BASE=https://s3.amazonaws.com/redismodules/tensorflow
110114
elif [[ $ARCH == arm32v7 ]]; then
111115
TF_ARCH=arm
@@ -205,7 +209,11 @@ if [[ $WITH_PT != 0 ]]; then
205209
if [[ $GPU != 1 ]]; then
206210
PT_BUILD=cpu
207211
else
208-
PT_BUILD=cu101
212+
if [[ $JETSON == 1 ]]; then
213+
PT_BUILD=cu102-jetson
214+
else
215+
PT_BUILD=cu101
216+
fi
209217
fi
210218
if [[ $ARCH == x64 ]]; then
211219
PT_ARCH=x86_64

opt/Makefile

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ make flow_tests # run flow test
5353
COV=1 # perform coverage analysis
5454
VALGRIND|VGD=1 # test with Valgrind (implies DEBUG=1)
5555
CALLGRIND|CGD=1 # test with Callgrind (implies DEBUG=1)
56+
REDIS=addr # Address of Redis server for testing
5657

5758
make cov-upload # upload coverage data to codecov.io (requires CODECOV_TOKEN)
5859

@@ -75,6 +76,7 @@ device selection options (fetch, build, and test):
7576
CPU=1 # build for CPU
7677
GPU=1 # build for GPU
7778
CUDA=1 # build for GPU
79+
JETSON=1 # build for Nvidia Jetson
7880
endef
7981

8082
#----------------------------------------------------------------------------------------------
@@ -85,10 +87,13 @@ ifeq ($(GPU),1)
8587
ifeq ($(CPU),1)
8688
$(error CPU=1 and GPU=1 (or CUDA=1) are conflicting)
8789
endif
88-
DEPS_FLAGS=gpu
90+
DEPS_FLAGS += GPU=1
8991
DEVICE=gpu
92+
ifeq ($(JETSON),1)
93+
DEPS_FLAGS += JETSON=1
94+
endif
9095
else
91-
DEPS_FLAGS=cpu
96+
DEPS_FLAGS += CPU=1
9297
DEVICE=cpu
9398
endif
9499

@@ -194,7 +199,7 @@ setup:
194199

195200
fetch deps:
196201
@echo Fetching dependencies...
197-
$(SHOW)VERBOSE=$(_SHOW) $(ROOT)/get_deps.sh $(DEPS_FLAGS)
202+
$(SHOW)VERBOSE=$(_SHOW) $(DEPS_FLAGS) $(ROOT)/get_deps.sh
198203

199204
format:
200205
./clang-format-all.sh
@@ -226,15 +231,29 @@ export SLAVES ?= 1
226231
export AOF ?= 1
227232
export CLUSTER ?= 1
228233

234+
define UNIT_TESTS
235+
$(SHOW)echo Running unit tests ...
236+
$(SHOW)\
237+
BINDIR=$(realpath $(BINDIR)) \
238+
$(ROOT)/tests/unit/tests.sh
239+
endef
240+
241+
define FLOW_TESTS
242+
$(SHOW)echo Running flow tests ...
243+
$(SHOW)\
244+
DEVICE=$(DEVICE) \
245+
MODULE=$(realpath $(INSTALLED_TARGET)) \
246+
CLUSTER=$(CLUSTER) \
247+
GEN=$(GEN) AOF=$(AOF) SLAVES=$(SLAVES) \
248+
VALGRIND=$(VALGRIND) \
249+
$(ROOT)/tests/flow/tests.sh
250+
endef
251+
229252
unit_tests: build
230-
@echo "$(BINDIR)"
231253
$(COVERAGE_RESET)
232-
$(SHOW)\
233-
BINDIR=$(realpath $(BINDIR)) \
234-
$(ROOT)/tests/unit/tests.sh
254+
$(UNIT_TESTS)
235255
$(COVERAGE_COLLECT_REPORT)
236256

237-
238257
flow_tests: build
239258
$(COVERAGE_RESET)
240259
$(SHOW)\
@@ -243,11 +262,14 @@ flow_tests: build
243262
CLUSTER=$(CLUSTER) \
244263
GEN=$(GEN) AOF=$(AOF) SLAVES=$(SLAVES) \
245264
VALGRIND=$(VALGRIND) \
265+
REDIS=$(REDIS) \
246266
$(ROOT)/tests/flow/tests.sh
267+
247268
$(COVERAGE_COLLECT_REPORT)
248269

249270
test: build
250271
$(COVERAGE_RESET)
272+
$(UNIT_TESTS)
251273
$(SHOW)\
252274
BINDIR=$(realpath $(BINDIR)) \
253275
$(ROOT)/tests/unit/tests.sh
@@ -257,9 +279,12 @@ test: build
257279
CLUSTER=$(CLUSTER) \
258280
GEN=$(GEN) AOF=$(AOF) SLAVES=$(SLAVES) \
259281
VALGRIND=$(VALGRIND) \
282+
REDIS=$(REDIS) \
260283
$(ROOT)/tests/flow/tests.sh
261284
$(COVERAGE_COLLECT_REPORT)
262285

286+
#----------------------------------------------------------------------------------------------
287+
263288
valgrind:
264289
$(SHOW)$(ROOT)/tests/flow/valgrind.sh $(realpath $(INSTALLED_TARGET))
265290

0 commit comments

Comments
 (0)