Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker: multi-version CUDA #704

Merged
merged 4 commits into from
Feb 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ARG BASE_IMAGE
FROM $BASE_IMAGE
ARG FIXUP=echo
kba marked this conversation as resolved.
Show resolved Hide resolved
MAINTAINER OCR-D
ENV DEBIAN_FRONTEND noninteractive
ENV PYTHONIOENCODING utf8
Expand Down Expand Up @@ -29,8 +30,10 @@ RUN apt-get update && apt-get -y install --no-install-recommends \
git \
&& pip3 install --upgrade pip setuptools \
&& make install \
&& $FIXUP \
&& rm -rf /build-ocrd


WORKDIR /data

CMD ["/usr/local/bin/ocrd", "--help"]
31 changes: 30 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,42 @@ pyclean:
# Docker
#

.PHONY: docker docker-cuda

# Build docker image
docker docker-cuda:
docker build -t $(DOCKER_TAG) --build-arg BASE_IMAGE=$(DOCKER_BASE_IMAGE) $(DOCKER_ARGS) .

# Build docker GPU / CUDA image
docker-cuda: DOCKER_BASE_IMAGE = nvidia/cuda:10.0-cudnn7-runtime-ubuntu18.04
docker-cuda: DOCKER_BASE_IMAGE = nvidia/cuda:11.3.1-cudnn8-runtime-ubuntu18.04
docker-cuda: DOCKER_TAG = ocrd/core-cuda
docker-cuda: DOCKER_ARGS += --build-arg FIXUP="make cuda-ubuntu cuda-ldconfig"

#
# CUDA
#

.PHONY: cuda-ubuntu cuda-ldconfig

# Install native CUDA toolkit in different versions
cuda-ubuntu: cuda-ldconfig
apt-get -y install --no-install-recommends cuda-runtime-10-0 cuda-runtime-10-1 cuda-runtime-10-2 cuda-runtime-11-0 cuda-runtime-11-1 cuda-runtime-11-3 libcudnn7

cuda-ldconfig: /etc/ld.so.conf.d/cuda.conf
ldconfig

/etc/ld.so.conf.d/cuda.conf:
@echo > $@
@echo /usr/local/cuda-10.0/lib64 >> $@
@echo /usr/local/cuda-10.0/targets/x86_64-linux/lib >> $@
@echo /usr/local/cuda-10.1/lib64 >> $@
@echo /usr/local/cuda-10.1/targets/x86_64-linux/lib >> $@
@echo /usr/local/cuda-10.2/lib64 >> $@
@echo /usr/local/cuda-10.2/targets/x86_64-linux/lib >> $@
@echo /usr/local/cuda-11.0/lib64 >> $@
@echo /usr/local/cuda-11.0/targets/x86_64-linux/lib >> $@
@echo /usr/local/cuda-11.1/lib64 >> $@
@echo /usr/local/cuda-11.1/targets/x86_64-linux/lib >> $@

# Build wheels and source dist and twine upload them
pypi: uninstall install
Expand Down