diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b10846a8..bda391df3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -168,18 +168,6 @@ IF(BUILD_ORT) ENDIF() ENDIF() -#---------------------------------------------------------------------------------------------- - -IF (APPLE) - FIND_LIBRARY(MKL_LIBRARIES NAMES mklml - PATHS ${depsAbs}/mkl/lib) - IF (NOT MKL_LIBRARIES) - MESSAGE(FATAL_ERROR "Could not find MKL for Mac") - ENDIF() - SET(platDeps "${MKL_LIBRARIES}") -ENDIF() - -#---------------------------------------------------------------------------------------------- IF(BUILD_TFLITE) # Find TensorFlow Lite stuff and build our wrapper @@ -307,14 +295,6 @@ IF(BUILD_ORT) FILES_MATCHING PATTERN ${LIB_PATTERN}) ENDIF() -#---------------------------------------------------------------------------------------------- - -IF (APPLE) - INSTALL(DIRECTORY ${depsAbs}/mkl/lib DESTINATION ${installAbs}/backends/redisai_torch - FILES_MATCHING PATTERN ${LIB_PATTERN}) -ENDIF() - -#---------------------------------------------------------------------------------------------- IF (NOT ${installAbs} STREQUAL ${CMAKE_SOURCE_DIR}/install-${DEVICE}) INSTALL_SYMLINK(${installAbs} ${CMAKE_SOURCE_DIR}/install-${DEVICE}) diff --git a/get_deps.sh b/get_deps.sh index 372b32d79..037988028 100755 --- a/get_deps.sh +++ b/get_deps.sh @@ -144,8 +144,16 @@ if [[ $OS == linux ]]; then else echo "Only x64 is supported currently" fi -else - echo "Only Linux OS is supported currently" +elif [[ $OS == macos ]]; then + TF_OS=darwin + TF_BUILD=cpu + TF_ARCH=x86_64 + if [[ $WITH_TF == S3 ]]; then + LIBTF_URL_BASE=https://s3.amazonaws.com/redismodules/tensorflow + else + LIBTF_URL_BASE=https://storage.googleapis.com/tensorflow/libtensorflow + fi + fi LIBTF_ARCHIVE=libtensorflow-${TF_BUILD}-${TF_OS}-${TF_ARCH}-${TF_VERSION}.tar.gz @@ -163,11 +171,11 @@ if [[ $OS == linux ]]; then TFLITE_OS="linux" if [[ $ARCH == x64 ]]; then TFLITE_ARCH=x86_64 - else - echo "Only x64 is supported currently" fi -else - echo "Only Linux OS is supported currently" +elif [[ $OS == macos ]]; then + TFLITE_OS=darwin + # TFLITE_BUILD=cpu + TFLITE_ARCH=x86_64 fi LIBTFLITE_ARCHIVE=libtensorflowlite-${TFLITE_OS}-${TFLITE_ARCH}-${TFLITE_VERSION}.tar.gz @@ -191,15 +199,17 @@ if [[ $OS == linux ]]; then else echo "Only x64 is supported currently" fi -else - echo "Only Linux OS is supported currently" + LIBTORCH_ARCHIVE=libtorch-cxx11-abi-shared-with-deps-${PT_VERSION}%2B${PT_BUILD}.zip + +elif [[ $OS == macos ]]; then + PT_OS=macos + PT_ARCH=x86_64 + PT_BUILD=cpu + PT_REPACK=1 + LIBTORCH_ARCHIVE=libtorch-macos-${PT_VERSION}.zip fi -if [[ $GPU != 1 ]]; then - LIBTORCH_ARCHIVE=libtorch-cxx11-abi-shared-with-deps-${PT_VERSION}%2B${PT_BUILD}.zip -else - LIBTORCH_ARCHIVE=libtorch-cxx11-abi-shared-with-deps-${PT_VERSION}%2B${PT_BUILD}.zip -fi + LIBTORCH_URL=https://download.pytorch.org/libtorch/$PT_BUILD/$LIBTORCH_ARCHIVE if [[ $WITH_PT != 0 ]]; then @@ -222,8 +232,11 @@ if [[ $OS == linux ]]; then else echo "Only x64 is supported currently" fi -else - echo "Only Linux OS is supported currently" +elif [[ $OS == macos ]]; then + ORT_OS=osx + ORT_ARCH=x64 + ORT_BUILD="" + ORT_URL_BASE=https://github.com/microsoft/onnxruntime/releases/download/v${ORT_VERSION} fi ORT_ARCHIVE=onnxruntime-${ORT_OS}-${ORT_ARCH}${ORT_BUILD}-${ORT_VERSION}.tgz diff --git a/opt/redis_valgrind.sup b/opt/redis_valgrind.sup index 3ad133780..b466a77bc 100644 --- a/opt/redis_valgrind.sup +++ b/opt/redis_valgrind.sup @@ -184,4 +184,11 @@ ... fun:_dl_catch_exception ... -} \ No newline at end of file +} + +{ + + Memcheck:Cond + ... + obj:*/libtorch_cpu.so* +} diff --git a/src/redisai.c b/src/redisai.c index 75a299ff4..1ae2890d1 100644 --- a/src/redisai.c +++ b/src/redisai.c @@ -736,10 +736,11 @@ int RedisAI_ScriptStore_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **ar ctx, "ERR Insufficient arguments, missing script entry points"); } - array_new_on_stack(const char *, nEntryPoints, entryPoints); + const char **entryPoints = array_new(const char *, nEntryPoints); for (size_t i = 0; i < nEntryPoints; i++) { const char *entryPoint; if (AC_GetString(&ac, &entryPoint, NULL, 0) != AC_OK) { + array_free(entryPoints); return RedisModule_ReplyWithError( ctx, "ERR Insufficient arguments, missing script entry points"); } @@ -754,6 +755,7 @@ int RedisAI_ScriptStore_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **ar } if (scriptdef == NULL) { + array_free(entryPoints); return RedisModule_ReplyWithError(ctx, "ERR Insufficient arguments, missing script SOURCE"); } @@ -767,6 +769,7 @@ int RedisAI_ScriptStore_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **ar "Backend TORCH not loaded, will try loading default backend"); int ret = RAI_LoadDefaultBackend(ctx, RAI_BACKEND_TORCH); if (ret == REDISMODULE_ERR) { + array_free(entryPoints); RedisModule_Log(ctx, "warning", "Could not load TORCH default backend"); int ret = RedisModule_ReplyWithError(ctx, "ERR Could not load backend"); RAI_ClearError(&err); @@ -776,7 +779,7 @@ int RedisAI_ScriptStore_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **ar script = RAI_ScriptCompile(devicestr, tag, scriptdef, entryPoints, (size_t)nEntryPoints, &err); } - + array_free(entryPoints); if (err.code != RAI_OK) { int ret = RedisModule_ReplyWithError(ctx, err.detail_oneline); RAI_ClearError(&err);