Docker Desktop for Windows의 GPU 지원
Docker Desktop for Windows의 GPU 지원
Docker Desktop의 GPU 지원은 WSL2 백엔드에서만 Windows에서 사용할 수 있어요. Windows용 Docker Desktop은 NVIDIA GPU에서 NVIDIA GPU Paravirtualization(GPU-PV)을 지원해서, AI, 머신러닝, 비디오 처리 같은 계산 집약적 워크로드에 컨테이너가 GPU 리소스를 쓸 수 있게 해줘요.
본문
사전 요구 사항 (Prerequisites)
WSL 2 GPU Paravirtualization을 활성화하려면 다음이 필요해요.
- NVIDIA GPU가 있는 Windows 머신
- 최신 Windows 10 또는 Windows 11 설치
- WSL 2 GPU Paravirtualization을 지원하는 최신 NVIDIA 드라이버
- 최신 버전의 WSL 2 Linux 커널. 명령줄에서
wsl --update를 사용 - Docker Desktop에서 WSL 2 백엔드가 켜져 있는지 확인
GPU 지원 검증하기
Docker 안에서 GPU 접근이 동작하는지 확인하려면 다음을 실행해요.
$ docker run --rm -it --gpus=all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark
이 명령은 GPU에서 n-바디 시뮬레이션 벤치마크를 실행해요. 출력은 대략 다음과 비슷해요.
Run "nbody -benchmark [-numbodies=]" to measure performance.
-fullscreen (run n-body simulation in fullscreen mode)
-fp64 (use double precision floating point values for simulation)
-hostmem (stores simulation data in host memory)
-benchmark (run benchmark to measure performance)
-numbodies= (number of bodies (>= 1) to run in simulation)
-device= (where d=0,1,2.... for the CUDA device to use)
-numdevices= (where i=(number of CUDA devices > 0) to use for simulation)
-compare (compares simulation results running once on the default GPU and once on the CPU)
-cpu (run n-body simulation on the CPU)
-tipsy= (load a tipsy model file for simulation)
> NOTE: The CUDA Samples are not meant for performance measurements. Results may vary when GPU Boost is enabled.
> Windowed mode
> Simulation data stored in video memory
> Single precision floating point simulation
> 1 Devices used for simulation
MapSMtoCores for SM 7.5 is undefined. Default to use 64 Cores/SM
GPU Device 0: "GeForce RTX 2060 with Max-Q Design" with compute capability 7.5
> Compute 7.5 CUDA device: [GeForce RTX 2060 with Max-Q Design]
30720 bodies, total time for 10 iterations: 69.280 ms
= 136.219 billion interactions per second
= 2724.379 single-precision GFLOP/s at 20 flops per interaction
실제 모델 실행: Docker Model Runner로 SmolLM2 실행
Docker Model Runner를 사용해 vLLM과 GPU 가속으로 SmolLM2 LLM을 실행할 수 있어요.
$ docker model install-runner --backend vllm --gpu cuda
올바르게 설치됐는지 확인해요.
$ docker model status
Docker Model Runner is running
Status:
llama.cpp: running llama.cpp version: c22473b
vllm: running vllm version: 0.11.0
모델을 실행해요.
$ docker model run ai/smollm2-vllm hi
Hello! I'm sure everything goes smoothly here. How can I assist you today?