RAPIDS

Dockerfile

runtime 이미지는 JupyterLab을 포함하고 있다. 8888 포트로 접속해보면 /app으로 바로 실행된다. 아래는 ssh 설정과 함께 conda도 실행해서 터미널에서도 개발이 가능한 환경이다.

FROM rapidsai/rapidsai:22.10-cuda11.5-runtime-ubuntu20.04-py3.9

WORKDIR /app
# Install essential packages.
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Asia/Seoul
RUN apt update
RUN apt install -y cmake libncurses5-dev libncursesw5-dev build-essential openssh-server vim sudo screen htop telnet net-tools

# nvtop
RUN git clone https://github.com/Syllo/nvtop.git
RUN mkdir -p nvtop/build && \
    cd nvtop/build && \
    cmake .. -DNVIDIA_SUPPORT=ON -DAMDGPU_SUPPORT=OFF -DINTEL_SUPPORT=OFF && \
    make && \
    make install

# SSH
# Create a user “sshuser” and group “sshgroup”
RUN groupadd sshgroup && useradd -ms /bin/bash -g sshgroup sshuser
# Create sshuser directory in home
RUN mkdir -p /home/sshuser/.ssh
# Copy the ssh public key in the authorized_keys file.
COPY id_rsa_rapids_docker.pub /home/sshuser/.ssh/authorized_keys
RUN chown sshuser:sshgroup /home/sshuser/.ssh/authorized_keys && chmod 600 /home/sshuser/.ssh/authorized_keys
# Copy the sudoer file.
COPY sshuser /etc/sudoers.d/
# Start ssh service
RUN service ssh start

# Specific settings for sshuser
## PyTorch
# RUN conda init bash
# RUN conda create --name pytorch --clone base
# RUN echo 'PATH="/opt/conda/bin:$PATH"' >> /home/sshuser/.profile
## RAPIDS
RUN echo "conda activate rapids" >> /home/sshuser/.bashrc

CMD ["/usr/sbin/sshd","-D"]

sshuser

# User privilege specification
sshuser ALL=(ALL) NOPASSWD:ALL

How to build

$ DOCKER_BUILDKIT=1 docker build . -t hyperai/rapidsai:latest

RAPIDS 실행

$ docker run -d --gpus all --rm \
    --shm-size=1g --ulimit memlock=-1 \
    --publish 2222:22 \
    --publish 8787:8787 \
    --publish 8888:8888 \
    --publish 8889:8889 \
    -v /home/hyperai2/skpark-workspace/rapids-docker:/app \
    -v /dask-data:/dask-data \
    hyperai/rapidsai:latest

attach로 연결:

$ docker attach e4413eeff75e

docker attach에서 세션을 유지한 상태에서 빠져나올 때 CTRL+P,Q를 눌러야 한다. screen에서는 CTRL+A,D였다. CTRL+D로 빠져나오면 세션을 종료한다.

Last Modified: 2022/11/10 15:44:07

is a collection of Papers I have written.
© 2000 - Sang-Kil Park Except where otherwise noted, content on this site is licensed under a CC BY 4.0.
This site design was brought from Distill.