Skip to content

Commit d001222

Browse files
committed
Merge master
2 parents 764b6b4 + 7c82c60 commit d001222

File tree

9 files changed

+90
-34
lines changed

9 files changed

+90
-34
lines changed

.circleci/config.yml

Lines changed: 68 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ commands:
1717
- run:
1818
name: Setup automation
1919
command: |
20-
PIP=1 ./opt/readies/bin/getpy3
20+
./opt/readies/bin/getpy3
2121
./opt/system-setup.py
2222
2323
build-steps:
@@ -125,6 +125,7 @@ jobs:
125125
- run:
126126
name: Submodule checkout
127127
command: git submodule update --init --recursive
128+
- setup-automation
128129
- run:
129130
name: lint
130131
command: |
@@ -201,7 +202,63 @@ jobs:
201202
- run:
202203
name: Test with valgrind
203204
command: |
204-
make -C opt test VALGRIND=1
205+
make -C opt test VALGRIND=1 CLUSTER=0 AOF=0
206+
no_output_timeout: 120m
207+
208+
valgrind-cluster:
209+
docker:
210+
- image: redisfab/rmbuilder:6.0.5-x64-buster
211+
steps:
212+
- checkout
213+
- run:
214+
name: Submodule checkout
215+
command: git submodule update --init --recursive
216+
- restore_cache:
217+
keys:
218+
- build-dependencies-{{ checksum "get_deps.sh" }}
219+
# If no exact match is found will get dependencies from source
220+
- setup-automation
221+
- run:
222+
name: Install dependencies
223+
command: |
224+
./opt/readies/bin/getredis -v 6 --valgrind --force
225+
./get_deps.sh cpu
226+
- run:
227+
name: Build for valgrind with cluster
228+
command: |
229+
make -C opt all VALGRIND=1 SHOW=1
230+
- run:
231+
name: Test with valgrind and cluster
232+
command: |
233+
make -C opt test VALGRIND=1 GEN=0 AOF=0
234+
no_output_timeout: 120m
235+
236+
valgrind-AOF:
237+
docker:
238+
- image: redisfab/rmbuilder:6.0.5-x64-buster
239+
steps:
240+
- checkout
241+
- run:
242+
name: Submodule checkout
243+
command: git submodule update --init --recursive
244+
- restore_cache:
245+
keys:
246+
- build-dependencies-{{ checksum "get_deps.sh" }}
247+
# If no exact match is found will get dependencies from source
248+
- setup-automation
249+
- run:
250+
name: Install dependencies
251+
command: |
252+
./opt/readies/bin/getredis -v 6 --valgrind --force
253+
./get_deps.sh cpu
254+
- run:
255+
name: Build for valgrind with AOF
256+
command: |
257+
make -C opt all VALGRIND=1 SHOW=1
258+
- run:
259+
name: Test with valgrind and AOF
260+
command: |
261+
make -C opt test VALGRIND=1 GEN=0 CLUSTER=0
205262
no_output_timeout: 120m
206263

207264
build-macos:
@@ -385,7 +442,8 @@ workflows:
385442
version: 2
386443
build_and_package:
387444
jobs:
388-
- lint
445+
- lint:
446+
<<: *on-any-branch
389447
- build-debian:
390448
<<: *on-any-branch
391449
<<: *after-linter
@@ -405,7 +463,13 @@ workflows:
405463
<<: *on-any-branch
406464
<<: *after-linter
407465
- valgrind:
408-
<<: *on-master
466+
<<: *on-any-branch
467+
<<: *after-linter
468+
- valgrind-cluster:
469+
<<: *on-integ-branch
470+
<<: *after-linter
471+
- valgrind-AOF:
472+
<<: *on-integ-branch
409473
<<: *after-linter
410474
- build-and-test-gpu:
411475
<<: *on-any-branch

docs/intro.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ This introduction is intended to present the core concepts it uses and the funct
88
!!! important "Prerequisites"
99
Before diving into RedisAI please make sure that you are familiar with the basic concepts of machine learning and Redis.
1010

11+
This video will introduce you to RedisAI at a high level. Give it a watch, then keep reading for more details.
12+
13+
<iframe width="560" height="315" src="https://www.youtube.com/embed/gbiqF-eyTW4" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
14+
1115
In broad strokes, RedisAI's looks as follows:
1216

1317
```

opt/system-setup.py

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,33 +18,28 @@ def __init__(self, nop=False):
1818

1919
def common_first(self):
2020
self.install_downloaders()
21-
self.setup_pip()
22-
self.pip_install("wheel virtualenv")
21+
self.pip_install("wheel")
2322

24-
if self.os == 'linux':
25-
self.install("ca-certificates")
26-
self.install("git unzip wget patchelf")
23+
self.install("git unzip patchelf")
2724
self.install("coreutils") # for realpath
2825

2926
def debian_compat(self):
3027
self.install("gawk")
3128
self.install("build-essential")
3229
self.install("libssl-dev")
33-
self.install("clang-format")
3430
self.install("python3-regex")
3531
self.install("python3-psutil python3-networkx python3-numpy")
36-
if self.arch == 'arm64v8' or self.arch == 'arm32v7':
32+
if self.platform.is_arm():
3733
self.install("python3-dev") # python3-skimage
3834
self.install("libmpich-dev libopenblas-dev") # for libtorch
3935
self.install_git_lfs_on_linux()
4036

4137
def redhat_compat(self):
4238
self.install("redhat-lsb-core")
43-
self.run("%s/readies/bin/enable-utf8" % HERE)
39+
self.run("%s/bin/enable-utf8" % READIES)
4440

45-
self.group_install("'Development Tools'")
4641
self.run("%s/bin/getgcc --modern" % READIES)
47-
self.install("llvm-toolset-7")
42+
# self.install("llvm-toolset-7")
4843

4944
if self.arch == 'x64':
5045
self.install_linux_gnu_tar()
@@ -63,7 +58,6 @@ def redhat_compat(self):
6358
def fedora(self):
6459
self.group_install("'Development Tools'")
6560
self.install("python3 python3-psutil python3-networkx")
66-
self.install("clang")
6761
self.install_git_lfs_on_linux()
6862

6963
def linux_last(self):
@@ -73,18 +67,13 @@ def macos(self):
7367
self.install_gnu_utils()
7468
self.install("git-lfs")
7569
self.install("redis")
76-
self.install("clang-format")
7770

7871
def common_last(self):
72+
self.run("%s/bin/getclang --format" % READIES)
7973
self.run("%s/bin/getcmake" % READIES)
8074

81-
self.run("python3 -m pip uninstall -y ramp-packer RLTest || true")
82-
# redis-py-cluster should be installed from git due to redis-py dependency
83-
self.pip_install("--no-cache-dir git+https://github.com/Grokzen/redis-py-cluster.git@master")
84-
self.pip_install("--no-cache-dir git+https://github.com/RedisLabsModules/RLTest.git@master")
85-
self.pip_install("--no-cache-dir git+https://github.com/RedisLabs/RAMP@master")
75+
self.run("{PYTHON} {READIES}/bin/getrmpytools".format(PYTHON=self.python, READIES=READIES))
8676

87-
self.pip_install("-r %s/readies/paella/requirements.txt" % HERE)
8877
self.pip_install("-r %s/tests/flow/test_requirements.txt" % ROOT)
8978

9079
self.pip_install("awscli")

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ file (GLOB BACKEND_COMMON_SRC
1616
err.c
1717
util/dict.c
1818
tensor.c
19+
util/string_utils.c
1920
serialization/ai_datatypes.c)
2021

2122
ADD_LIBRARY(redisai_obj OBJECT

src/backends.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ int RAI_LoadBackend_TensorFlow(RedisModuleCtx *ctx, const char *path) {
122122
}
123123

124124
backend.model_serialize = (int (*)(RAI_Model *, char **, size_t *, RAI_Error *))(
125-
unsigned long)dlsym(handle, "RAI_ModelSerializeTF");
125+
(unsigned long)dlsym(handle, "RAI_ModelSerializeTF"));
126126
if (backend.model_serialize == NULL) {
127127
dlclose(handle);
128128
RedisModule_Log(ctx, "warning",

src/libtorch_c/torch_extensions/torch_redis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ torch::IValue redisExecute(std::string fn_name, std::vector<std::string> args )
5656
RedisModuleCallReply *reply = RedisModule_Call(ctx, fn_name.c_str(), "!v", arguments, len);
5757
RedisModule_ThreadSafeContextUnlock(ctx);
5858
torch::IValue value = IValueFromRedisReply(reply);
59-
RedisModule_FreeThreadSafeContext(ctx);
6059
RedisModule_FreeCallReply(reply);
60+
RedisModule_FreeThreadSafeContext(ctx);
6161
for(int i= 0; i < len; i++){
6262
RedisModule_FreeString(NULL, arguments[i]);
6363
}

src/tensor.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,14 @@ int Tensor_DataTypeStr(DLDataType dtype, char *dtypestr) {
9898
RAI_Tensor *RAI_TensorCreateWithDLDataType(DLDataType dtype, long long *dims, int ndims,
9999
int tensorAllocMode) {
100100

101+
size_t dtypeSize = Tensor_DataTypeSize(dtype);
102+
if (dtypeSize == 0) {
103+
return NULL;
104+
}
105+
101106
RAI_Tensor *ret = RedisModule_Alloc(sizeof(*ret));
102107
int64_t *shape = RedisModule_Alloc(ndims * sizeof(*shape));
103108
int64_t *strides = RedisModule_Alloc(ndims * sizeof(*strides));
104-
size_t dtypeSize = Tensor_DataTypeSize(dtype);
105109

106110
size_t len = 1;
107111
for (int64_t i = 0; i < ndims; ++i) {
@@ -189,6 +193,7 @@ RAI_Tensor *_TensorCreateWithDLDataTypeAndRString(DLDataType dtype, size_t dtype
189193
}
190194
char *data = RedisModule_Alloc(nbytes);
191195
memcpy(data, blob, nbytes);
196+
RAI_HoldString(NULL, rstr);
192197

193198
RAI_Tensor *ret = RedisModule_Alloc(sizeof(*ret));
194199
ret->tensor = (DLManagedTensor){.dl_tensor = (DLTensor){.ctx = ctx,
@@ -686,7 +691,6 @@ int RAI_parseTensorSetArgs(RedisModuleString **argv, int argc, RAI_Tensor **t, i
686691

687692
if (datafmt == TENSOR_BLOB) {
688693
RedisModuleString *rstr = argv[argpos];
689-
RedisModule_RetainString(NULL, rstr);
690694
*t = _TensorCreateWithDLDataTypeAndRString(datatype, datasize, dims, ndims, rstr, error);
691695
} else {
692696
*t = RAI_TensorCreateWithDLDataType(datatype, dims, ndims, tensorAllocMode);

tests/flow/tests_dag.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ def test_dagrun_ro_modelrun_scriptrun_resnet(env):
230230
if(VALGRIND):
231231
env.debugPrint("skipping {} since it's hanging CI".format(sys._getframe().f_code.co_name), force=True)
232232
env.skip()
233+
233234
con = env.getConnection()
234235
model_name = 'imagenet_model{{1}}'
235236
script_name = 'imagenet_script{{1}}'

tests/flow/tests_tensorflow.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,6 @@ def test_run_mobilenet(env):
8484

8585
@skip_if_no_TF
8686
def test_run_mobilenet_multiproc(env):
87-
if VALGRIND:
88-
env.debugPrint("skipping {} since VALGRIND=1".format(
89-
sys._getframe().f_code.co_name), force=True)
90-
return
9187

9288
con = env.getConnection()
9389

@@ -634,10 +630,7 @@ def test_tensorflow_modelrun_disconnect(env):
634630

635631
@skip_if_no_TF
636632
def test_tensorflow_modelrun_with_batch_and_minbatch(env):
637-
if VALGRIND:
638-
env.debugPrint("skipping {} since VALGRIND=1".format(
639-
sys._getframe().f_code.co_name), force=True)
640-
return
633+
641634
con = env.getConnection()
642635
batch_size = 2
643636
minbatch_size = 2

0 commit comments

Comments
 (0)