일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- 25년 3월 미국 증시 분석
- Cudnn 버전 확인
- 트럼프 미국 관세
- Python Numpy
- 25년 3월 11일 미국 증시 분석
- 코딩 사이트 정리
- 연체용어
- 스코어카드 예시
- 딥러닝
- 주식 데이터 수집
- 트럼프 2025년 미국 관세
- 2025년 3월 6일 미국 증시 분석
- python pandas
- 25년 3월 증시 분석
- css risk
- 취업사이트 정리
- 미국 투자 분석
- 딥러닝 제대로 시작하기
- 25년 3월 12일 미국 증시 분석
- css 리스크
- 미국 증시 방향성
- 미국 증시 분석
- 관세 설명
- css 리스크관리
- 연체 css
- 미장 분석
- jupyter notebook PDF
- 스코어카드 만드는법
- 미국 시황
- 2025년도 미국 관세
Archives
- Today
- Total
koos808
파이썬에서 GPU 정보와 GPU 사용 유무 확인하는 여러 코드 본문
728x90
반응형
- 파이썬에서 GPU 정보와 GPU 사용 유무 확인하기
# 방법 1 : torch version import torch print(torch.cuda.is_available()) print(torch.cuda.device_count()) print(torch.cuda.get_device_name(torch.cuda.current_device())) # 방법 1-2 : torch version 2 from torch import cuda assert cuda.is_available() assert cuda.device_count() > 0 print(cuda.get_device_name(cuda.current_device())) # 방법 2 : tensorflow version import tensorflow as tf tf.__version__ ## 방법 2-1 : 모든 사용 가능한 GPU List 보기 from tensorflow.python.client import device_lib print(device_lib.list_local_devices()) # 방법 2-2 tf.config.list_physical_devices('GPU') # 방법 2-3 tf.config.experimental.list_physical_devices('GPU') # 방법 2-4 tf.debugging.set_log_device_placement(True) a = tf.constant([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]) b = tf.constant([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]]) c = tf.matmul(a, b) print(c) # 방법 3 : confirm Keras sees the GPU from keras import backend assert len(backend.tensorflow_backend._get_available_gpus()) > 0 # 주로 사용하는 코드 1 import tensorflow as tf from tensorflow.python.client import device_lib device_lib.list_local_devices() tf.config.list_physical_devices('GPU') # 주로 사용하는 코드 2 : 인식한 GPU 개수 출력 import tensorflow as tf print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU')))
728x90
반응형
'Python' 카테고리의 다른 글
Python information성 불필요 메시지 미출력 방법 (0) | 2023.09.11 |
---|---|
Python pydot, graphviz 설치 방법 및 순서 (0) | 2023.09.11 |
주피터노트북 아나콘다 프롬프트, 리눅스 가상환경 관련 코드(간단) (0) | 2021.04.11 |
주피터노트북에서 파이썬 버전확인하는 방법 (0) | 2021.04.11 |
파이썬 폴더 없으면 생성하기, 코드 시작 시간으로 폴더 생성하기 os.path.exists(), time.localtime() (0) | 2021.04.11 |
Comments