본문 바로가기
ML or DL/개발환경

[딥러닝 환경구축] Tensorflow-gpu 정상 작동 확인하기 (GPU 점유확인)

by chaloalto 2022. 5. 11.

이전 글에서 CUDA, cuDNN, Tensorflow-gpu 가 정상적으로 확인하기 위한 테스트.

기본적으로 아래 코드를 통해 정상 작동하는지 확인 할 수 있다. 

import tensorflow as tf
tf.test.is_built_with_cuda()
tf.config.list_physical_devices('GPU') # tensorflow >=2.4.0
tf.test.is_gpu_available('GPU') #tensorflow 1.x
tf.sysconfig.get_build_info()

추가로 실제 딥러닝 코드에서 Train 및 Inference 가 잘 되는지를 확인. 

https://keras.io/examples/timeseries/timeseries_anomaly_detection/

 

Keras documentation: Timeseries anomaly detection using an Autoencoder

Timeseries anomaly detection using an Autoencoder Author: pavithrasv Date created: 2020/05/31 Last modified: 2020/05/31 Description: Detect anomalies in a timeseries using an Autoencoder. View in Colab • GitHub source Introduction This script demonstrate

keras.io

위는 시계열 데이터에 대한 이상탐지 소스코드(Timeseries Anomaly Detection).

코드를 실행시, Train 및 Inference 과정에서 GPU 메모리가 정상적으로 점유되는지를 확인 할 수 있다. 

테스트 방법

1. 아래 github 코드 clone / 다운로드 

https://github.com/changhwanjoe/check_tensorfow-gpu

 

GitHub - changhwanjoe/check_tensorfow-gpu: Timeseries anomaly detection using an Autoencoder

Timeseries anomaly detection using an Autoencoder. Contribute to changhwanjoe/check_tensorfow-gpu development by creating an account on GitHub.

github.com

2. matplotlib, pandas 라이브러리 설치 

pip install pandas matplotlib

3. 소스 실행

python check.py

4.GPU 메모리 확인

Train / Inference 과정에서 작업관리자 - 성능 - GPU 탭의 GPU 메모리가 점유되는지 확인 

GPU 메모리 점유 확인