GPU 머신에서 Machine Learning을 수행할때 Deep Learning 툴킷 & 패키지들이 GPU를 이용하는지 체크하는 python 코드
- GPU 기반 tensorflow나 keras를 실행할때, 속도가 느리거나 문제로 인해 체크가 필요한 경우가 있음.
- 클라우드 GPU VM이나, MLaaS 서비스를 이용할때, VM에 SSH로 접근이 어려우면 python code로 확인 해야 함.
아래의 python 코드로 코드 체크 가능
GPU 사용 여부 체크 python 코드
import tensorflow as tf if tf.test.gpu_device_name(): print('Default GPU Device: {}'.format(tf.test.gpu_device_name())) else: print("Please install GPU version of TF") |
참고 링크
How to tell if tensorflow is using gpu acceleration from inside python shell? - Stack Overflow