Skip to content

Commit 21d9da2

Browse files
rafiefilipecosta90
andauthored
PT 1.5 & TF 1.15.0 w/cuda10.1 + ORT 1.2.0 (#347)
* PyTorch 1.5 & Redis 5.0.8 * fixes 1 * ONNXRuntime 1.2.0 * GPU-related changes * fixes 1 Co-authored-by: filipe oliveira <filipecosta.90@gmail.com>
1 parent 0b66cde commit 21d9da2

File tree

9 files changed

+66
-38
lines changed

9 files changed

+66
-38
lines changed

Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# BUILD redisfab/redisai-cpu-${OSNICK}:${VERSION}-${ARCH}
1+
# BUILD redisfab/redisai:${VERSION}-cpu-${ARCH}-${OSNICK}
22

3-
ARG REDIS_VER=5.0.7
3+
ARG REDIS_VER=5.0.8
44

55
# OSNICK=bionic|stretch|buster
66
ARG OSNICK=buster
@@ -39,7 +39,6 @@ RUN if [ "$PACK" = "1" ]; then make -C opt pack; fi
3939
RUN if [ "$TEST" = "1" ]; then make -C opt test $BUILD_ARGS NO_LFS=1; fi
4040

4141
#----------------------------------------------------------------------------------------------
42-
# FROM redis:latest
4342
FROM redisfab/redis:${REDIS_VER}-${ARCH}-${OSNICK}
4443

4544
RUN set -e; apt-get -qq update; apt-get -q install -y libgomp1

Dockerfile.gpu

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# BUILD redisfab/redisai-gpu:${VERSION}-${ARCH}-${OSNICK}
1+
# BUILD redisfab/redisai:${VERSION}-gpu-${ARCH}-${OSNICK}
22

3-
ARG REDIS_VER=5.0.7
3+
ARG REDIS_VER=5.0.8
44

55
# OSNICK=bionic|centos7|centos6
66
ARG OSNICK=bionic
@@ -10,7 +10,7 @@ ARG ARCH=x64
1010

1111
#----------------------------------------------------------------------------------------------
1212
FROM redisfab/redis:${REDIS_VER}-${ARCH}-${OSNICK} AS redis
13-
FROM nvidia/cuda:10.0-cudnn7-devel-ubuntu18.04 AS builder
13+
FROM nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04 AS builder
1414

1515
# ENV DEPS "git ca-certificates wget unzip cmake libgomp1 patchelf coreutils tcl libjemalloc-dev"
1616
ENV NVIDIA_VISIBLE_DEVICES all
@@ -40,7 +40,7 @@ RUN if [ "$PACK" = "1" ]; then make -C opt pack GPU=1; fi
4040
RUN if [ "$TEST" = "1" ]; then TEST="" make -C opt test GPU=1 $BUILD_ARGS NO_LFS=1; fi
4141

4242
#----------------------------------------------------------------------------------------------
43-
FROM nvidia/cuda:10.0-cudnn7-runtime-ubuntu18.04
43+
FROM nvidia/cuda:10.1-cudnn7-runtime-ubuntu18.04
4444

4545
RUN set -e; apt-get -qq update; apt-get -q install -y libgomp1
4646

Dockerfile.gpu-test

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# BUILD redisfab/redisai-gpu:${VERSION}-${ARCH}-${OSNICK}-test
1+
# BUILD redisfab/redisai:${VERSION}-gpu-${ARCH}-${OSNICK}-test
22

3-
ARG REDIS_VER=5.0.7
3+
ARG REDIS_VER=5.0.8
44

55
# OSNICK=bionic|centos7|centos6
66
ARG OSNICK=bionic
@@ -10,7 +10,7 @@ ARG ARCH=x64
1010

1111
#----------------------------------------------------------------------------------------------
1212
FROM redisfab/redis:${REDIS_VER}-${ARCH}-${OSNICK} AS redis
13-
FROM nvidia/cuda:10.0-cudnn7-devel-ubuntu18.04 AS builder
13+
FROM nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04 AS builder
1414

1515
SHELL ["/bin/bash", "-c"]
1616

@@ -35,7 +35,7 @@ COPY ./get_deps.sh .
3535
RUN set -e ;\
3636
. venv/bin/activate ;\
3737
if [[ -z $DEPS_ARGS ]]; then \
38-
./get_deps.sh gpu ;\
38+
VERBOSE=1 ./get_deps.sh gpu ;\
3939
else \
4040
env $DEPS_ARGS ./get_deps.sh gpu ;\
4141
fi

get_deps.sh

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ if [[ $1 == --help || $1 == help ]]; then
1414
[ARGVARS...] get_deps.sh [cpu|gpu] [--help|help]
1515
1616
Argument variables:
17-
VERBOSE=1 Print commands
18-
FORCE=1 Download even if present
19-
WITH_DLPACK=0 Skip dlpack
20-
WITH_TF=0 Skip Tensorflow
21-
WITH_TFLITE=0 Skip Tensorflow
22-
WITH_PT=0 Skip PyTorch
23-
WITH_ORT=0 Skip OnnxRuntime
17+
CPU=1 Get CPU dependencies
18+
GPU=1 Get GPU dependencies
19+
VERBOSE=1 Print commands
20+
FORCE=1 Download even if present
21+
WITH_DLPACK=0 Skip dlpack
22+
WITH_TF=0|S3 Skip Tensorflow or download from S3 repo
23+
WITH_TFLITE=0|S3 Skip TensorflowLite or download from S3 repo
24+
WITH_PT=0|S3 Skip PyTorch or download from S3 repo
25+
WITH_ORT=0|S3 Skip OnnxRuntime or download from S3 repo
2426
2527
END
2628
exit 0
@@ -29,10 +31,10 @@ fi
2931
set -e
3032
[[ $VERBOSE == 1 ]] && set -x
3133

32-
if [[ "$1" == "cpu" ]]; then
34+
if [[ "$1" == "cpu" || $CPU == 1 ]]; then
3335
GPU=0
3436
DEVICE=cpu
35-
elif [[ "$1" == "gpu" ]]; then
37+
elif [[ "$1" == "gpu" || $GPU == 1 ]]; then
3638
GPU=1
3739
DEVICE=gpu
3840
else
@@ -100,7 +102,13 @@ if [[ $WITH_TF != 0 ]]; then
100102
if [[ $ARCH == x64 ]]; then
101103
TF_VERSION=1.15.0
102104
TF_ARCH=x86_64
103-
LIBTF_URL_BASE=https://storage.googleapis.com/tensorflow/libtensorflow
105+
106+
# special case for 1.15.0 as official version does not suport CUDA 10.1
107+
if [[ $WITH_TF == S3 || $GPU == 1 ]]; then
108+
LIBTF_URL_BASE=https://s3.amazonaws.com/redismodules/tensorflow
109+
else
110+
LIBTF_URL_BASE=https://storage.googleapis.com/tensorflow/libtensorflow
111+
fi
104112
elif [[ $ARCH == arm64v8 ]]; then
105113
TF_VERSION=1.15.0
106114
TF_ARCH=arm64
@@ -115,7 +123,11 @@ if [[ $WITH_TF != 0 ]]; then
115123
TF_OS=darwin
116124
TF_BUILD=cpu
117125
TF_ARCH=x86_64
118-
LIBTF_URL_BASE=https://storage.googleapis.com/tensorflow/libtensorflow
126+
if [[ $WITH_TF == S3 ]]; then
127+
LIBTF_URL_BASE=https://s3.amazonaws.com/redismodules/tensorflow
128+
else
129+
LIBTF_URL_BASE=https://storage.googleapis.com/tensorflow/libtensorflow
130+
fi
119131
fi
120132

121133
LIBTF_ARCHIVE=libtensorflow-${TF_BUILD}-${TF_OS}-${TF_ARCH}-${TF_VERSION}.tar.gz
@@ -186,7 +198,7 @@ fi # WITH_TFLITE
186198

187199
###################################################################################### LIBTORCH
188200

189-
PT_VERSION="1.4.0"
201+
PT_VERSION="1.5.0"
190202

191203
if [[ $WITH_PT != 0 ]]; then
192204
[[ $FORCE == 1 ]] && rm -rf $LIBTORCH
@@ -270,7 +282,7 @@ fi
270282

271283
################################################################################### ONNXRUNTIME
272284

273-
ORT_VERSION="1.0.0"
285+
ORT_VERSION="1.2.0"
274286

275287
if [[ $WITH_ORT != 0 ]]; then
276288
[[ $FORCE == 1 ]] && rm -rf $ONNXRUNTIME

opt/Makefile

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,14 @@ make test # run tests
4444
CALLGRIND|CGD=1 # test with Callgrind (implies DEBUG=1)
4545
make cov-upload # upload coverage data to codecov.io (requires CODECOV_TOKEN)
4646

47-
make pack # create installation packages
48-
PACK_DEPS=0 # do not pack dependencies
49-
INTO=dir # place artifacts in `dir`
50-
BRANCH=name # use `name` as branch name
51-
make deploy # copy packages to S3
52-
make release # release a version
53-
make docker # build docker image
47+
make pack # create installation packages
48+
PACK_DEPS=0 # do not pack dependencies
49+
INTO=dir # place artifacts in `dir`
50+
BRANCH=name # use `name` as branch name
51+
make deploy # copy packages to S3
52+
make release # release a version
53+
make docker # build docker image
54+
make docker-gpu-test # run GPU tests
5455

5556
fetch and build options:
5657
WITH_TF=0 # SKip TensofFlow
@@ -204,3 +205,9 @@ callgrind:
204205

205206
docker:
206207
$(SHOW)docker build -t redisai --build-arg TEST=1 --build-arg PACK=1 ..
208+
209+
docker-gpu-test:
210+
$(SHOW)set -e ;\
211+
cd .. ;\
212+
docker build -f Dockerfile.gpu-test -t redisai-test:latest-$(DEVICE)-$(ARCH)-$(OS) .
213+
docker run --gpus all -it redisai-test:latest-$(DEVICE)-$(ARCH)-$(OS)

opt/build/libtorch/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
ROOT=../../..
33

4-
VERSION ?= 1.4.0
4+
VERSION ?= 1.5.0
55
OSNICK ?= buster
66

77
#----------------------------------------------------------------------------------------------

opt/build/libtorch/repack.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,24 @@ ROOT=$(realpath $ROOT)
1111

1212
if [[ "$1" == "cpu" ]]; then
1313
GPU=0
14+
DEVICE=cpu
1415
elif [[ "$1" == "gpu" ]]; then
1516
GPU=1
17+
DEVICE=gpu
1618
else
1719
GPU=${GPU:-0}
20+
if [[ $GPU == 1 ]]; then
21+
DEVICE=gpu
22+
else
23+
DEVICE=cpu
24+
fi
1825
fi
1926

2027
OS=$(python3 $ROOT/opt/readies/bin/platform --os)
2128
ARCH=$(python3 $ROOT/opt/readies/bin/platform --arch)
2229

30+
TARGET_DIR=$ROOT/deps//$OS-$ARCH-$DEVICE
31+
2332
# avoid wget warnings on macOS
2433
[[ $OS == macosx ]] && export LC_ALL=en_US.UTF-8
2534

@@ -74,5 +83,5 @@ if [[ $OS == linux ]]; then
7483
fi
7584

7685
unzip -q -o $LIBTORCH_ZIP
77-
tar czf libtorch-${PT_BUILD}-${PT_OS}-${PT_ARCH}-${PT_VERSION}.tar.gz libtorch/
86+
tar czf $TARGET_DIR/libtorch-${PT_BUILD}-${PT_OS}-${PT_ARCH}-${PT_VERSION}.tar.gz libtorch/
7887
rm -rf libtorch/ $LIBTORCH_ZIP

src/libtorch_c/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
add_library(torch_c STATIC torch_c.cpp)
22
target_link_libraries(torch_c "${TORCH_LIBRARIES}")
3-
set_property(TARGET torch_c PROPERTY CXX_STANDARD 11)
3+
set_property(TARGET torch_c PROPERTY CXX_STANDARD 14)

src/libtorch_c/torch_c.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
#include "torch_c.h"
2-
#include <torch/torch.h>
3-
#include <torch/csrc/jit/import.h>
4-
#include <torch/csrc/jit/script/compilation_unit.h>
2+
#include "torch/torch.h"
3+
#include "torch/csrc/jit/serialization/import.h"
4+
#include "torch/csrc/jit/api/compilation_unit.h"
5+
#include "ATen/Functions.h"
6+
57
#include <iostream>
68
#include <sstream>
79

8-
#include <ATen/Functions.h>
910

1011
namespace {
1112

0 commit comments

Comments
 (0)