|
| 1 | +FROM lablup/common-base:py38-cuda11.3 |
| 2 | + |
| 3 | +# Install PyTorch |
| 4 | +ENV PYTORCH_VERSION=1.11.0 |
| 5 | +ENV TORCHVISION_VERSION=0.12.0 |
| 6 | +ENV TORCHAUDIO_VERSION=0.9.0 |
| 7 | +ENV TORCHTEXT_VERSION=0.10.0 |
| 8 | +ENV TENSORBOARDX_VERSION=2.1 |
| 9 | + |
| 10 | +RUN python3 -m pip uninstall -y torch && \ |
| 11 | + python3 -m pip install -U pip==21.1.2 setuptools==57.0.0 && \ |
| 12 | + python3 -m pip install --no-cache-dir \ |
| 13 | + http://download.pytorch.org/whl/cu113/torch-1.11.0%2Bcu113-cp38-cp38-linux_x86_64.whl \ |
| 14 | + http://download.pytorch.org/whl/cu102/torchvision-0.12.0%2Bcu102-cp38-cp38-linux_x86_64.whl \ |
| 15 | + http://download.pytorch.org/whl/cu113/torchaudio-0.11.0%2Bcu113-cp38-cp38-linux_x86_64.whl \ |
| 16 | + http://download.pytorch.org/whl/torchserve-0.3.0-py2.py3-none-any.whl \ |
| 17 | + http://download.pytorch.org/whl/torchtext-0.12.0-cp38-cp38-linux_x86_64.whl \ |
| 18 | + http://download.pytorch.org/whl/cu101/torchcsprng-0.2.1%2Bcu101-cp38-cp38-linux_x86_64.whl \ |
| 19 | + http://download.pytorch.org/whl/torch_model_archiver-0.3.0-py2.py3-none-any.whl \ |
| 20 | + http://download.pytorch.org/whl/torch_tb_profiler-0.1.0-py3-none-any.whl \ |
| 21 | + jsonargparse \ |
| 22 | + torchmetrics \ |
| 23 | + pyDeprecate \ |
| 24 | + fsspec[http]>=2021.05.0 \ |
| 25 | + PyYAML>=5.1 \ |
| 26 | + pretrainedmodels \ |
| 27 | + cnn-finetune \ |
| 28 | + keras4torch \ |
| 29 | + pytorch-lightning |
| 30 | + |
| 31 | +# torch2trt PyTorch to TensorRT converter which utilizes the TensorRT Python API |
| 32 | +WORKDIR /tmp |
| 33 | +RUN git clone --branch=v0.3.0 https://github.com/NVIDIA-AI-IOT/torch2trt /tmp/torch2trt && \ |
| 34 | + cd /tmp/torch2trt && \ |
| 35 | + python3 setup.py install --plugins && \ |
| 36 | + rm -fr /tmp/torch2trt |
| 37 | + |
| 38 | +RUN python3 -m pip install --extra-index-url \ |
| 39 | + https://developer.download.nvidia.com/compute/redist --upgrade nvidia-dali-cuda110 |
| 40 | + |
| 41 | +# Install Horovod, temporarily using CUDA stubs |
| 42 | +RUN ldconfig /usr/local/cuda/targets/x86_64-linux/lib/stubs && \ |
| 43 | + HOROVOD_GPU_ALLREDUCE=NCCL HOROVOD_GPU_BROADCAST=NCCL \ |
| 44 | + HOROVOD_WITHOUT_TENSORFLOW=1 HOROVOD_WITH_PYTORCH=1 HOROVOD_WITHOUT_MXNET=1 \ |
| 45 | + pip install --no-cache-dir horovod==0.24.2 && \ |
| 46 | + ldconfig |
| 47 | + |
| 48 | +RUN python3 -m pip install --no-cache-dir \ |
| 49 | + mpi4py==3.1.3 \ |
| 50 | + mlflow==1.24.0 \ |
| 51 | + nni==2.6.1 \ |
| 52 | + tensorboard-plugin-wit \ |
| 53 | + scikit-nni==0.2.1 |
| 54 | + |
| 55 | +RUN apt autoclean && \ |
| 56 | + sed -i 's/source \/usr\/local\/nvm\/nvm.sh//' /etc/bash.bashrc && \ |
| 57 | + ln -sf /usr/share/terminfo/x/xterm-color /usr/share/terminfo/x/xterm-256color && \ |
| 58 | + rm -rf /var/lib/apt/lists/* && \ |
| 59 | + rm -rf /root/.cache && \ |
| 60 | + rm -rf /tmp/* |
| 61 | + |
| 62 | +COPY ./service-defs /etc/backend.ai/service-defs |
| 63 | +COPY ./runner-scripts/bootstrap.sh runner-scripts/setup_multinode.py /opt/container/ |
| 64 | + |
| 65 | +# Install ipython kernelspec |
| 66 | +Run python3 -m ipykernel install --display-name "PyTorch 1.11.0 on Python 3.8 (CUDA 11.3)" && \ |
| 67 | + cat /usr/local/share/jupyter/kernels/python3/kernel.json |
| 68 | + |
| 69 | +# Backend.AI specifics |
| 70 | +LABEL ai.backend.kernelspec="1" \ |
| 71 | + ai.backend.envs.corecount="OPENBLAS_NUM_THREADS,OMP_NUM_THREADS,NPROC" \ |
| 72 | + ai.backend.features="batch query uid-match user-input" \ |
| 73 | + ai.backend.base-distro="ubuntu16.04" \ |
| 74 | + ai.backend.resource.min.cpu="1" \ |
| 75 | + ai.backend.resource.min.mem="1g" \ |
| 76 | + ai.backend.resource.min.cuda.device=0 \ |
| 77 | + ai.backend.resource.min.cuda.shares=0 \ |
| 78 | + ai.backend.runtime-type="python" \ |
| 79 | + ai.backend.runtime-path="/usr/bin/python3" \ |
| 80 | + ai.backend.service-ports="ipython:pty:3000,jupyter:http:8081,jupyterlab:http:8090,vscode:http:8180,tensorboard:http:6006,mlflow-ui:preopen:5000,nniboard:preopen:8080" |
| 81 | + |
| 82 | +WORKDIR /home/work |
| 83 | +# vim: ft=dockerfile |
0 commit comments