RAPIDS

Dask-cuDF

CLI 실행:

$ dask scheduler --dashboard-address :30001
$ dask-cuda-worker 127.0.0.1:8786

dask 및 jupyter등 여러 프로세스를 한 번에 구동하기 위해 supervisord 사용

설정

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

Docker 실행

$ 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: 2023/01/12 13:17:40

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.