728x90
Tensorflow
from tensorflow.python.client import device_lib
device_lib.list_local_devices()
만약 위에서 import 에러가 뜬다면 아래 코드를 활용해서 tensorflow를 재설치해본다.
pip install --upgrade pip
pip uninstall tensorflow
pip install tensorflow
CPU만 사용 가능하다면, 위 명령어의 결과에 CPU 관련 정보만 표시된다
Pytorch
import torch
torch.cuda.is_available() # GPU 사용 확인
torch.cuda.get_device_name(0) # 사용가능한 GPU 개수 반환
torch.cuda.device_count() # 환경 변수에 의해 사용가능한 GPU
728x90
'Setting' 카테고리의 다른 글
리눅스에서 gpu 사용량 확인하기 (0) | 2023.01.12 |
---|---|
리눅스에서 구글 클라우드 사용 위한 gsutill 설치 (0) | 2023.01.11 |
vscode로 docker container에 연결하기, error running command remote-containers.attachtorunningcontainerfromviewlet shell server terminated (0) | 2023.01.03 |
vscode로 서버에 원격 접속하기 (0) | 2023.01.02 |
Ubuntu에서 Docker 실행해보기 (0) | 2022.08.12 |