Skip to content

Commit 1f9ce0d

Browse files
authored
Support different CUDA versions for the slim Python Predictor image (#1263)
1 parent dbe78b7 commit 1f9ce0d

File tree

4 files changed

+30
-9
lines changed

4 files changed

+30
-9
lines changed

build/build-image.sh

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,27 @@ dir=$1
4141
image=$2
4242

4343
docker build "$ROOT" \
44-
-f $dir/Dockerfile \
45-
-t cortexlabs/${image} \
46-
-t cortexlabs/${image}:${CORTEX_VERSION}
44+
-f $dir/Dockerfile \
45+
-t cortexlabs/${image} \
46+
-t cortexlabs/${image}:${CORTEX_VERSION}
4747

4848
if [ "$slim" == "true" ]; then
49-
docker build "$ROOT" \
49+
if [ "${image}" == "python-predictor-gpu" ]; then
50+
cuda=("10.0" "10.1" "10.2" "11.0")
51+
cudnn=("7" "7" "7" "8")
52+
53+
for i in ${!cudnn[@]}; do
54+
docker build "$ROOT" \
5055
-f $dir/Dockerfile \
5156
--build-arg SLIM=true \
52-
-t cortexlabs/${image}-slim \
53-
-t cortexlabs/${image}-slim:${CORTEX_VERSION}
57+
--build-arg CUDA_VERSION=${cuda[$i]} \
58+
--build-arg CUDNN=${cudnn[$i]} \
59+
-t cortexlabs/${image}-slim:${CORTEX_VERSION}-cuda${cuda[$i]}
60+
done
61+
else
62+
docker build "$ROOT" \
63+
-f $dir/Dockerfile \
64+
--build-arg SLIM=true \
65+
-t cortexlabs/${image}-slim:${CORTEX_VERSION}
66+
fi
5467
fi

build/push-image.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,11 @@ echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
4242
docker push cortexlabs/${image}:${CORTEX_VERSION}
4343

4444
if [ "$slim" == "true" ]; then
45-
docker push cortexlabs/${image}-slim:${CORTEX_VERSION}
45+
if [ "$image" == "python-predictor-gpu" ]; then
46+
for cuda in 10.0 10.1 10.2 11.0; do
47+
docker push cortexlabs/${image}-slim:${CORTEX_VERSION}-cuda${cuda}
48+
done
49+
else
50+
docker push cortexlabs/${image}-slim:${CORTEX_VERSION}
51+
fi
4652
fi

docs/deployments/system-packages.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Cortex's base Docker images are listed below. Depending on the Cortex Predictor
5050

5151
<!-- CORTEX_VERSION_BRANCH_STABLE x6 -->
5252
* Python Predictor (CPU): `cortexlabs/python-predictor-cpu-slim:master`
53-
* Python Predictor (GPU): `cortexlabs/python-predictor-gpu-slim:master`
53+
* Python Predictor (GPU): `cortexlabs/python-predictor-gpu-slim:master-cuda10.1` (also available in cuda10.0, cuda10.2, and cuda11.0)
5454
* Python Predictor (Inferentia): `cortexlabs/python-predictor-inf-slim:master`
5555
* TensorFlow Predictor (CPU, GPU, Inferentia): `cortexlabs/tensorflow-predictor-slim:master`
5656
* ONNX Predictor (CPU): `cortexlabs/onnx-predictor-cpu-slim:master`

images/python-predictor-gpu/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
FROM nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04
1+
ARG CUDA_VERSION=10.1
2+
ARG CUDNN=7
3+
FROM nvidia/cuda:$CUDA_VERSION-cudnn$CUDNN-devel-ubuntu18.04
24

35
RUN apt-get update -qq && apt-get install -y -q \
46
build-essential \

0 commit comments

Comments
 (0)