Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
- 3d
- 통계
- chagpt
- Computer Vision
- 머신러닝
- 딥러닝 #deep learning #machine learning #computer vision #object detection
- 고유값 분해
- Python
- mobile deep learning
- 수학
- 쿠버플로우
- deep learning mesh
- semi supervised learning
- segmentation
- psuedo label
- deep learning on mobile
- cnn
- 딥러닝
- semi supervised semantic segmentation
- Deep Learning
- convolution neural network
- domain adaptation
- depth data
- GPT
- depth map
- sudo 권한
- GPT 논문
- zero shot
- 파이썬
- GPT 1
Archives
- Today
- Total
튼튼한 나무
파이썬 코드로 GPU memory print 하기 본문
import pynvml
import torch
def get_memory_free_MiB(gpu_index):
pynvml.nvmlInit()
handle = pynvml.nvmlDeviceGetHandleByIndex(int(gpu_index))
mem_info = pynvml.nvmlDeviceGetMemoryInfo(handle)
total= mem_info.total // 1024 ** 2
free = mem_info.free // 1024 ** 2
return free, total
print('GPU Memory : ',{f'GPU-{i}':f'{get_memory_free_MiB(i)[0]:,d}/{get_memory_free_MiB(i)[1]:,d} MiB' for i in range(torch.cuda.device_count())})

print('GPU Memory : ',{f'GPU-{i}':f'{get_memory_free_MiB(i)[0]:,d}/{get_memory_free_MiB(i)[1]:,d} MiB' for i in range(torch.cuda.device_count())})
or
print('GPU Memory : ',{f'GPU{i}':f'{get_memory_free_MiB(i)[0]:,d}/{get_memory_free_MiB(i)[1]:,d} MiB' for i in os.environ['CUDA_VISIBLE_DEVICES'].split(',')})
'computing' 카테고리의 다른 글
| Kubernetes(k8s) 개념 설명 feat. ML 모델 서빙 (0) | 2023.08.16 |
|---|---|
| 모바일 배포를 위해 pytorch 및 tensorflow 모델 변환이 필요한 이유 완전 정복하기 (feat. onnx or tflite) (0) | 2023.07.11 |
| jupyter notebook에서 tensorboard 실시간으로 확인하기 (0) | 2023.01.03 |
| 파이썬으로 sudo권한 shell 명령어 실행하기 (0) | 2023.01.02 |
| docker에서 한국 시간으로 날짜 설정하기 (0) | 2022.03.22 |
Comments