728x90
반응형
SMALL
NVIDIA Driver
NVIDIA에서 제품에 맞는 드라이버를 설치한다.
WSL2 설치
PowerShell에서 WLS2를 설치한다.
wls --install
PowerShell에서 nvidia-smi 명령으로 GPU 서버를 확인한다.
nvidia-smi
Miniconda 설치
Miniconda Windows 프로그램을 설치한다.
콘다 환경 만들기
다음 명령을 사용하여 tf 라는 새 conda 환경을 만든다.
conda create --name tf python=3.9
가상 환경 활성화에서 에러가 발생한다면 PowerShell 실행 정책을 변경해야 한다.
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
If using 'conda activate' from a batch script, change your
invocation to 'CALL conda.bat activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- cmd.exe
- fish
- tcsh
- xonsh
- zsh
- powershell
See 'conda init --help' for more information and options.
PowerShell에서 다음 명령을 사용한다.
PS C:\Users> Get-ExecutionPolicy -Scope CurrentUser
Undefined
PS C:\Users> Get-ExecutionPolicy
Restricted
PS C:\Users> Get-ExecutionPolicy -List
Scope ExecutionPolicy
----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser Undefined
LocalMachine Undefined
다음 명령을 통해 인증서를 신뢰할 수 있는 인증 기관으로 가져와서 AllSigned 또는 RemoteSigned 실행 정책으로 서명된 스크립트를 실행할 수 있다.
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
그 다음, 생성한 가상 환경을 활성화한다.
conda activate tf
CUDA 설치
conda install -c conda-forge cudatoolkit=11.2 cudnn=8.1.0
TensorFlow 설치
TensorFlow는 PyPI에만 공식적으로 출시되므로 pip 업그레이드를 권장한다.
pip install --upgrade pip
# Anything above 2.10 is not supported on the GPU on Windows Native
pip install "tensorflow<2.11"
설치 확인
PowerShell에서 CPU 설정을 확인한다.
python -c "import tensorflow as tf; print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
텐서가 반환되면 TensorFlow가 성공적으로 설치된 것이다. 그 다음으로, GPU 설정을 확인한다.
python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"
[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]
python -c "from tensorflow.python.client import device_lib; print(device_lib.list_local_devices())"
GPU 장치 목록이 반환되면 TensorFlow가 성공적으로 설치된 것이다.
728x90
반응형
LIST
'Python Library' 카테고리의 다른 글
ITK (0) | 2023.11.29 |
---|---|
[Sphinx] Sphinx 프로젝트 온라인 배포 (3) (0) | 2022.05.02 |
[Sphinx] Sphinx 프로젝트 온라인 배포 (2) (0) | 2022.05.02 |
[Sphinx] Sphinx 프로젝트 온라인 배포 (1) (0) | 2022.05.02 |
[Sphinx] 코드에서 자동 문서 생성 (2) (0) | 2022.05.02 |