From 70d0661b4e4ae397053da8a827bd8a22f84fbbed Mon Sep 17 00:00:00 2001 From: Thamme Gowda Date: Wed, 19 Oct 2022 11:30:58 -0700 Subject: [PATCH] Checkin docker files --- ...7.1-ub20.04-py3.9_tr1.10_cu11.4.dockerfile | 45 ++++++++++++++++++ .../rtg-model-0.7.1-600toEng-v2.0.dockerfile | 17 +++++++ ...odel-arm64cpu-0.7-600toEng-v2.0.dockerfile | 47 +++++++++++++++++++ docs/howto-release.adoc | 18 +++++-- 4 files changed, 124 insertions(+), 3 deletions(-) create mode 100644 dockers/rtg-0.7.1-ub20.04-py3.9_tr1.10_cu11.4.dockerfile create mode 100644 dockers/rtg-model-0.7.1-600toEng-v2.0.dockerfile create mode 100644 dockers/rtg-model-arm64cpu-0.7-600toEng-v2.0.dockerfile diff --git a/dockers/rtg-0.7.1-ub20.04-py3.9_tr1.10_cu11.4.dockerfile b/dockers/rtg-0.7.1-ub20.04-py3.9_tr1.10_cu11.4.dockerfile new file mode 100644 index 0000000..e19f9da --- /dev/null +++ b/dockers/rtg-0.7.1-ub20.04-py3.9_tr1.10_cu11.4.dockerfile @@ -0,0 +1,45 @@ +# What is this: USC ISI Coral team's MT pipeline +# Authors: +# - Thamme Gowda +# Created : Oct 20, 2020 + +# build instr https://www.docker.com/blog/multi-arch-images/ + +#FROM nvidia/cuda:10.2-devel-ubuntu18.04 +#FROM nvidia/cuda:11.1-devel-ubuntu20.04 +FROM nvidia/cuda:11.4.0-runtime-ubuntu20.04 + +# suppress prompts https://stackoverflow.com/a/67452950/1506477 +ARG DEBIAN_FRONTEND=noninteractive +RUN apt update \ + && apt install -y curl python3.9 python3-pip python3.9-dev \ + build-essential git locales locales-all \ + && apt-get autoremove --purge + +ENV LC_ALL en_US.UTF-8 +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US.UTF-8 + +# Update pip +RUN ln -s /usr/bin/python3.9 /usr/bin/python && python -m pip install --upgrade pip + +#Make non-root user; +RUN useradd --create-home rtguser +#RUN chown -Rv rtguser:rtguser /home/rtguser + +WORKDIR /home/rtguser +USER rtguser + +# pip installed bins go here, they needs to be in PATH +RUN mkdir -p /home/rtguser/.local/bin /home/rtguser/rtg +ENV CUDA_HOME="/usr/local/cuda/" +ENV PATH="/home/rtguser/.local/bin:/usr/local/cuda/bin:${PATH}" + +#COPY --chown=rtguser:rtguser . /home/rtguser/rtg/ +# && cd /home/rtguser/rtg && pip install --editable . \ + +RUN pip install --user torch==1.12 flask==2.1 uwsgi rtg==0.7.1 \ + && pip cache purge + +CMD bash + diff --git a/dockers/rtg-model-0.7.1-600toEng-v2.0.dockerfile b/dockers/rtg-model-0.7.1-600toEng-v2.0.dockerfile new file mode 100644 index 0000000..b2ebad0 --- /dev/null +++ b/dockers/rtg-model-0.7.1-600toEng-v2.0.dockerfile @@ -0,0 +1,17 @@ +# What is this: USC ISI Coral team's MT pipeline +# Authors: +# - Thamme Gowda +# Created : March 15, 2022 + +FROM tgowda/rtg:0.7.1-ub20.04-py3.9_tr1.10_cu11.4 +# Download pretrained model from rtg demo website + +RUN cd /home/rtguser/ && \ + curl -O http://rtg.isi.edu/many-eng/models/many-eng-v2.0-rtg600eng1024d_ful74k.tgz && \ + tar xvf many-eng-v2.0-rtg600eng1024d_ful74k.tgz --one-top-level=many-eng-v2.0-600toeng --strip-components 1 && \ + rm *.tgz + +#CMD rtg-serve /home/rtguser/ +#CMD python -m rtg.serve /home/rtguser/many-eng-v2.0-600toeng +CMD uwsgi --http 0.0.0.0:6060 --module rtg.serve.app:app --pyargv "/home/rtguser/many-eng-v2.0-600toeng" + diff --git a/dockers/rtg-model-arm64cpu-0.7-600toEng-v2.0.dockerfile b/dockers/rtg-model-arm64cpu-0.7-600toEng-v2.0.dockerfile new file mode 100644 index 0000000..73dbbec --- /dev/null +++ b/dockers/rtg-model-arm64cpu-0.7-600toEng-v2.0.dockerfile @@ -0,0 +1,47 @@ +# RTG docker, without cuda, for arm64 cpu such as Apple silicon, Qualcomm snapdragon, Microsoft SQ etc +# Authors: +# - Thamme Gowda +# Created : March 15, 2022 +FROM ubuntu:22.04 + +# suppress prompts https://stackoverflow.com/a/67452950/1506477 +ARG DEBIAN_FRONTEND=noninteractive +RUN apt update \ + && apt install -y curl python3.9 python3-pip python3.9-dev \ + build-essential git locales locales-all \ + && apt-get autoremove --purge + +ENV LC_ALL en_US.UTF-8 +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US.UTF-8 + +# Update pip +RUN ln -s /usr/bin/python3.9 /usr/bin/python && python -m pip install --upgrade pip + +#Make non-root user; +RUN useradd --create-home rtguser +#RUN chown -Rv rtguser:rtguser /home/rtguser + +WORKDIR /home/rtguser +USER rtguser + +# pip installed bins go here, they needs to be in PATH +RUN mkdir -p /home/rtguser/.local/bin /home/rtguser/rtg +ENV PATH="/home/rtguser/.local/bin:${PATH}" + +#COPY --chown=rtguser:rtguser . /home/rtguser/rtg/ +# && cd /home/rtguser/rtg && pip install --editable . \ + +RUN pip install --user torch==1.10.2 flask==2.0.3 uwsgi rtg==0.7 setuptools==59.5.0 && pip cache purge + +CMD bash + +RUN cd /home/rtguser/ && \ + curl -O http://rtg.isi.edu/many-eng/models/many-eng-v2.0-rtg600eng1024d_ful74k.tgz && \ + tar xvf many-eng-v2.0-rtg600eng1024d_ful74k.tgz --one-top-level=many-eng-v2.0-600toeng --strip-components 1 && \ + rm *.tgz + +#CMD rtg-serve /home/rtguser/ +#CMD python -m rtg.serve /home/rtguser/many-eng-v2.0-600toeng +CMD uwsgi --http 0.0.0.0:6060 --module rtg.serve.app:app --pyargv "/home/rtguser/many-eng-v2.0-600toeng" + diff --git a/docs/howto-release.adoc b/docs/howto-release.adoc index 904042c..67c4bae 100644 --- a/docs/howto-release.adoc +++ b/docs/howto-release.adoc @@ -56,14 +56,26 @@ For the first time users of PyPI, you need to create an account at https://pypi. == Docker Release -=== Docker for ARM64 +With Apple moving to ARM chips, running x64/AMD64 docker images on ARM64/AARCH64 is not efficient, +Follow instructions at https://www.docker.com/blog/multi-arch-images/ to build multi-arch images. -With Apple moving to ARM chips, running AMD64 docker images on ARM is not efficient. +.Docker setup +[source,bash] +---- +docker buildx ls +docker buildx create --name mybuilder +docker buildx use mybuilder +docker buildx inspect --bootstrap +# You should see in ouput: Platforms: linux/amd64, linux/arm64, linux/arm/v7, linux/arm/v6 +---- [source,bash] ---- cd dockers + # find a suitable docker file to build; e.g., this one -docker build . -f rtg-0.7-py39_tr110_cu114.dockerfile-t tgowda/rtg:0.7-py39_tr110_cu114 +docker buildx build --platform linux/amd64,linux/arm64 . -f rtg-0.7-py39_tr110_cu114.dockerfile-t tgowda/rtg:0.7-py39_tr110_cu114 --push ---- + +