내용

글번호 1247
작성자 허진경 (나자바바)
작성일 2023-10-17 11:06:04
제목 Windows, TF 2.12 이상 GPU 사용하려면
내용 참고: https://www.tensorflow.org/install/pip?hl=ko#windows-wsl2 1. NVidia GPU 드라이버 설치: https://www.nvidia.com/download/index.aspx?lang=en-us 2. CUDA 툴킷 11.8: https://developer.nvidia.com/cuda-toolkit-archive 3. cuDNN SDK 8.6: https://developer.nvidia.com/cudnn 4. 윈도우 WSL2 설치: https://learn.microsoft.com/ko-kr/windows/wsl/install 5. WSL2에서 NVidia GPU 지원 설정: https://docs.nvidia.com/cuda/wsl-user-guide/index.html C:\> wsl.exe --install C:\> wsl.exe --update C:\> wsl.exe 우분투 설치된 후 아이디 비번 설정해야 함 에러나면 윈도우 기능 켜기/끄기에서 Linux용 Windows 하위 시스템 체크를 켜고 재부팅(체크되어 있는 상태면 체크 해재 후 다시 체크) 다음 명령은 리눅스 프롬프트에서 실행 sudo apt-key del 7fa2af80 6. WSL-Ubuntu 패키지를 사용하여 Linux x86 CUDA 도구 키트 설치(Linux WSL-Ubuntu 2.0 x86_64 다운로드 및 설치) https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=WSL-Ubuntu&target_version=2.0&target_type=deb_local wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600 wget https://developer.download.nvidia.com/compute/cuda/12.2.2/local_installers/cuda-repo-wsl-ubuntu-12-2-local_12.2.2-1_amd64.deb sudo dpkg -i cuda-repo-wsl-ubuntu-12-2-local_12.2.2-1_amd64.deb sudo cp /var/cuda-repo-wsl-ubuntu-12-2-local/cuda-*-keyring.gpg /usr/share/keyrings/ sudo apt-get update sudo apt-get -y install cuda 7. 윈도우 파워쉘로 돌아와서 텐서플로우 설치 python.exe -m pip install --upgrade pip pip install tensorflow[and-cuda] 8. 텐서플로우 설치 확인 python -c "import tensorflow as tf; print(tf.reduce_sum(tf.random.normal([1000, 1000])))" 예상 결과: tf.Tensor(895.5301, shape=(), dtype=float32) 9. GPU 설정 확인 python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"