<참조> https://data-newbie.tistory.com/561
Python , GPU 모니터링 GPUtil 예제
import GPUtil
from threading import Thread
import time
class Monitor(Thread):
def __init__(self, delay):
super(Monitor, self).__init__()
self.stopped = False
self.delay = delay # 검사 간격 (초)
self.start()
def run(self):
while not self.stopped:
GPUtil.showUtilization()
time.sleep(self.delay)
def stop(self):
self.stopped = True
monitor = Monitor(5) # 5초 간격으로 검사 결과를 출력
# monitor.stop() # 모니터링 종료
반응형
'Python 활용' 카테고리의 다른 글
파이썬 소켓 프로그래밍 - 클라이언트/서버 예제 (0) | 2022.02.14 |
---|---|
파이썬, 항목 유사도 검사 (0) | 2022.02.11 |
파이썬, Parallel HTTP requests (requests_futures 이용) (0) | 2022.01.30 |
파이썬, 다중 HTTP 요청 (synchronous, multiprocessing, multithreading, asyncio) (0) | 2022.01.29 |
API Requests 속도 향상 (Async Python) (0) | 2022.01.28 |