πŸͺŸ Windows νŒŒμ΄ν† μΉ˜ μ„€μΉ˜ κ°€μ΄λ“œ (NVIDIA CUDA & CPU)

Windows ν™˜κ²½μ—μ„œλŠ” NVIDIA μ™Έμž₯ κ·Έλž˜ν”½ μΉ΄λ“œ(GeForce RTX μ‹œλ¦¬μ¦ˆ λ“±)의 μœ λ¬΄μ— 따라 μ„€μΉ˜ λͺ…λ Ήμ–΄κ°€ λ‚˜λ‰©λ‹ˆλ‹€.


πŸ” 1단계: NVIDIA κ·Έλž˜ν”½ μΉ΄λ“œ 및 λ“œλΌμ΄λ²„ 확인

  1. λͺ…λ Ή ν”„λ‘¬ν”„νŠΈ(CMD) λ˜λŠ” PowerShell을 μ—½λ‹ˆλ‹€.
  2. μ•„λž˜ λͺ…λ Ήμ–΄λ‘œ NVIDIA λ“œλΌμ΄λ²„κ°€ μΈμ‹λ˜λŠ”μ§€ ν™•μΈν•©λ‹ˆλ‹€:
    nvidia-smi
    
  3. ν‘œ 우츑 상단에 ν‘œμ‹œλ˜λŠ” CUDA Version: 12.x 숫자λ₯Ό ν™•μΈν•©λ‹ˆλ‹€. μ΄λŠ” ν˜„μž¬ λ“œλΌμ΄λ²„κ°€ 지원할 수 μžˆλŠ” μ΅œλŒ€ CUDA 버전을 μ˜λ―Έν•©λ‹ˆλ‹€.

πŸ“¦ 2단계: PyTorch μ„€μΉ˜ λͺ…λ Ήμ–΄ μ‹€ν–‰

μ˜΅μ…˜ A: NVIDIA GPU (CUDA 12.1 ꢌμž₯)

μ΅œμ‹  RTX 30xx, 40xx κ·Έλž˜ν”½ μΉ΄λ“œλ₯Ό μ‚¬μš© 쀑이라면 μ•„λž˜ λͺ…λ Ήμ–΄λ₯Ό μ‹€ν–‰ν•©λ‹ˆλ‹€:

pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121

μ˜΅μ…˜ B: NVIDIA GPU (CUDA 11.8 κ΅¬ν˜• κ·Έλž˜ν”½ μΉ΄λ“œ)

GTX 10xx, 16xx λ“± κ΅¬ν˜• κ·Έλž˜ν”½ μΉ΄λ“œλΌλ©΄ CUDA 11.8 버전을 ꢌμž₯ν•©λ‹ˆλ‹€:

pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

μ˜΅μ…˜ C: μ™Έμž₯ κ·Έλž˜ν”½ μΉ΄λ“œκ°€ μ—†λŠ” 경우 (CPU Only)

λ‚΄μž₯ κ·Έλž˜ν”½λ§Œ νƒ‘μž¬λœ λ…ΈνŠΈλΆμ΄λ‚˜ μ‚¬λ¬΄μš© PC라면 CPU μ „μš© 버전을 μ„€μΉ˜ν•©λ‹ˆλ‹€:

pip install torch torchvision torchaudio

🚨 Windows μ„€μΉ˜ μ‹œ 자주 λ°œμƒν•˜λŠ” 문제 ν•΄κ²°

1) Microsoft Visual C++ Redistributable λˆ„λ½

νŒŒμ΄ν† μΉ˜ μž„ν¬νŠΈ μ‹œ DLL load failed while importing _C 였λ₯˜κ°€ λ°œμƒν•˜λ©΄, Microsoft 곡식 μ›Ήμ‚¬μ΄νŠΈμ—μ„œ Visual C++ 2015-2022 재배포 κ°€λŠ₯ νŒ¨ν‚€μ§€(x64)λ₯Ό λ‹€μš΄λ‘œλ“œν•˜μ—¬ μ„€μΉ˜ν•΄μ•Ό ν•©λ‹ˆλ‹€.

2) CUDA 가속 확인

PowerShellμ—μ„œ μ•„λž˜ μ½”λ“œλ‘œ GPU 인식을 κ²€μ¦ν•©λ‹ˆλ‹€:

python -c "import torch; print('CUDA μ‚¬μš© κ°€λŠ₯:', torch.cuda.is_available(), 'μž₯치λͺ…:', torch.cuda.get_device_name(0) if torch.cuda.is_available() else 'μ—†μŒ')"
μ„œλΈŒλͺ©μ°¨