# enroot 테스트
Enroot 란 ?
* Enroot
Enroot는 경량의 컨테이너 실행 도구입니다. 주로 단일 사용자 환경에서 컨테이너를 실행할 수 있도록 설계되었습니다. Enroot는 단순한 설계로, 도커(Docker) 이미지를 직접 실행할 수 있고, 복잡한 설정 없이 빠르게 컨테이너를 실행할 수 있습니다. SLURM과 함께 사용하면, Enroot는 클러스터의 각 노드에서 컨테이너를 실행하는 데 도움을 줍니다.
주요 기능:
경량성: Enroot는 복잡한 설정 없이 간단하게 컨테이너를 실행할 수 있습니다.
도커 이미지 지원: Enroot는 도커 이미지를 변환하지 않고도 직접 실행할 수 있습니다.
빠른 시작: 빠르게 컨테이너를 시작하고 종료할 수 있습니다.
* Pyxis
Pyxis는 Enroot를 SLURM과 통합하는 플러그인입니다. Pyxis를 사용하면 SLURM 작업으로 컨테이너를 쉽게 실행할 수 있습니다. 즉, 사용자가 SLURM 스크립트에서 바로 컨테이너를 실행할 수 있게 도와주는 도구입니다.
주요 기능:
SLURM 통합: SLURM 배치 스크립트에서 직접 컨테이너를 실행할 수 있도록 도와줍니다.
간단한 사용법: SLURM 작업을 제출할 때, 추가 옵션만으로 컨테이너를 실행할 수 있습니다.
확장성: 대규모 클러스터 환경에서도 쉽게 확장 가능하며, 여러 노드에서 동시에 컨테이너를 실행할 수 있습니다.
---------
* 요약
Enroot: 경량의 컨테이너 실행 도구로, 도커 이미지를 간단하게 실행할 수 있음.
Pyxis: Enroot를 SLURM과 통합하여, SLURM 작업으로 컨테이너를 쉽게 실행할 수 있게 해줌.
---------
========================================================================================
#### Enroot (https://github.com/NVIDIA/enroot) : 모든 작업 노드에 설치
1. requirement
curl -fSsL -O https://github.com/NVIDIA/enroot/releases/download/v3.4.1/enroot-check_3.4.1_$(uname -m).run
chmod +x enroot-check_*.run
./enroot-check_*.run --verify
./enroot-check_*.run
Bundle ran successfully!
2. installation
# standard flavor
arch=$(dpkg --print-architecture)
curl -fSsL -O https://github.com/NVIDIA/enroot/releases/download/v3.4.1/enroot_3.4.1-1_${arch}.deb
curl -fSsL -O https://github.com/NVIDIA/enroot/releases/download/v3.4.1/enroot+caps_3.4.1-1_${arch}.deb # 필수는 아님
sudo apt install -y ./*.deb
# From source
sudo apt install -y git gcc make libcap2-bin libtool automake libmd-dev
# git
git clone --recurse-submodules https://github.com/NVIDIA/enroot.git
# Install runtime dependencies
# Debian-based distributions
sudo apt install -y curl gawk jq squashfs-tools parallel
sudo apt install -y fuse-overlayfs libnvidia-container-tools pigz squashfuse # 필수는 아님
# build and install Enroot
cd enroot
sudo make install
# allow unprivileged users to import images
sudo make setcap
3. Usage
Usage: enroot COMMAND [ARG...]
Command line utility for manipulating container sandboxes.
Commands:
batch [options] [--] CONFIG [COMMAND] [ARG...]
bundle [options] [--] IMAGE
create [options] [--] IMAGE
exec [options] [--] PID COMMAND [ARG...]
export [options] [--] NAME
import [options] [--] URI
list [options]
remove [options] [--] NAME...
start [options] [--] NAME|IMAGE [COMMAND] [ARG...]
version
# Import the CUDA 10.0 image from NVIDIA GPU Cloud
$ enroot import 'docker://$oauthtoken@nvcr.io#nvidia/cuda:10.0-base'
# Create a container out of it
$ enroot create --name cuda nvidia+cuda+10.0-base.sqsh
$ enroot list
cuda
# Compile the nbody sample inside the container
$ enroot start --root --rw cuda sh -c 'apt update && apt install -y cuda-samples-10.0'
$ enroot start --rw cuda sh -c 'cd /usr/local/cuda/samples/5_Simulations/nbody && make -j'
# Run nbody leveraging the X server from the host
$ export ENROOT_MOUNT_HOME=y NVIDIA_DRIVER_CAPABILITIES=all
$ enroot start --env DISPLAY --env NVIDIA_DRIVER_CAPABILITIES --mount /tmp/.X11-unix:/tmp/.X11-unix cuda \
/usr/local/cuda/samples/5_Simulations/nbody/nbody
# Remove the container
$ enroot remove cuda
========================================================================================
#### Pyxis (https://github.com/NVIDIA/pyxis) : 모든 작업 노드에 설치
# 사전 enroot 확인
-> Pyxis requires the enroot container utility (version 3.1.0) to be installed.
enroot version # 해당 명령어 통해 enroot 확인
# installation (deb)
wget https://download.schedmd.com/slurm/slurm-23.11.6.tar.bz2
tar -xvjf slurm-23.11.6.tar.bz2
---> slurm과 pyxis의 버전은 같아야 한다. 아래 버전 동일한 pyxis 설치해야함.
git clone https://github.com/NVIDIA/pyxis
cd pyxis
sudo make clean
SLURM_DIR=${PATH}/slurm-23.11.6 make
sudo apt-get install devscripts
sudo apt-get install debhelper
sudo apt-get install libslurm-dev
cd ..
sudo make deb
sudo dpkg -i nvslurm-plugin-pyxis_0.19.0-1_amd64.deb
sudo mkdir -p /etc/slurm/plugstack.conf.d
sudo ln -s /usr/share/pyxis/pyxis.conf /etc/slurm/plugstack.conf.d/pyxis.conf
sudo vi /etc/slurm/plugstack.conf
include /etc/slurm/plugstack.conf.d/* => 추가
sudo systemctl restart slurmd
# test
vi test_pyxis.sbatch
#!/bin/bash
#SBATCH --job-name=test_pyxis
#SBATCH --output=output.txt
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --mem=1G
# Pyxis와 Enroot를 사용하여 도커 컨테이너 실행
srun --container-image=docker://ubuntu:latest --container-name=test_container /bin/echo "Hello, Pyxis!"
sbatch test_pyxis.sbatch
cat output.txt
=> Hello, Pyxis! 뜨면 테스트 성공!
'Nvidia > AI' 카테고리의 다른 글
SuperPOD 및 BCM 기본 (0) | 2024.06.14 |
---|---|
DeepOps로 Slurm 테스트 (0) | 2024.05.20 |
slurm Admin (0) | 2024.05.20 |
slurm 설치 (0) | 2024.05.20 |
Nvidia Nemo를 이용하여 gemma-7b 모델 사용하기 (0) | 2024.04.25 |