Yerleşik sensör kullanılarak NVIDIA Jetson gömülü GPU'ların güç ve enerji tüketiminin ölçülmesi
Power and energy measurement of NVIDIA Jetson embedded GPUs using built-in sensor
Yazar: BÜŞRA ASLAN
Danışman: DR. ÖĞR. ÜYESİ AYŞE YILMAZER METİN
İstanbul Teknik Üniversitesi / Lisansüstü Eğitim Enstitüsü / Bilgisayar Mühendisliği Ana Bilim Dalı / Bilgisayar Mühendisliği Bilim Dalı
Derece: Yüksek Lisans, 2023
Konu: Bilgisayar Mühendisliği Bilimleri-Bilgisayar ve Kontrol = Computer Engineering and Computer Science and Control
Dizin: Evrişimli sinir ağları = Convolutional neural networks ; Gömülü sistemler = Embedded systems ; Güç = Power

Özet:
Günümüzde GPU'lar iyi bir geliştirme seçeneği haline gelmiştir. Çünkü daha yüksek performans ve daha iyi enerji verimliliği sağlayabildikleri görülmüştür. Artan hesaplama gücüyle birlikte ısınma, pil ömrü ve enerji tüketimi önemli hale gelmiştir. GPU üzerinde çalıştırılacak uygulamaların enerji optimizasyonu yolunda ilk olarak işlemci seviyesinde doğru güç ölçümlerine ihtiyaç vardır. Ancak güç tüketiminin doğru şekilde ölçülmesi kolay bir işlem değildir. Çünkü GPU'ların yazılım ve donanım mimarileri karmaşıktır ve geliştiricileri tarafından detaylı şekilde raporlanmamaktadır. Güç ölçümü için doğrudan ölçüm ve dolaylı ölçüm olmak üzere iki yöntem bulunmaktadır. Doğrudan ölçüm tekniklerinde harici veya dahili güç ölçerler kullanılmaktadır. Dolaylı ölçüm tekniklerinde ise bir model kullanılarak güç tüketimi tahmin edilmektedir. NVIDIA Jetson ailesi, yapay zekâ uygulamaları için düşük güç tüketimi ile yüksek performans sunan uç cihazlardır. Bant genişliği ve gecikmenin önemli olduğu yüksek performans gerektiren uygulamalar için uygundur. Geçmişten günümüze değin birçok işlemcinin güç ve enerji tüketimi araştırılmıştır. Bu çalışmada NVIDIA Jetson TX2 modülünde bulunan yerleşik güç sensörü kullanılarak GPU'nun güç ölçümleri alırken gözlemlenen bulgular anlatılmaktadır. Güç profili zamana karşı güç tüketimini gösteren grafiktir. Bu grafiğin altında kalan alan enerji tüketimine karşılık gelir. Yerleşik sensörün örnekleme hızı kısıtlıdır ancak ek donanıma ihtiyaç olmadan kolay şekilde güç profili çıkarılmasına olanak sağlar. Yerleşik sensörden elde edilen güç verileri ile ilgili tutarsız davranışlar gözlemlenmiştir. Örneğin, bir GPU çekirdek programı arka arkaya iki kez çalıştırıldığında, güç tüketimi ilk yürütmede boşta seviyeden başlarken ikinci yürütmede daha yüksek seviyeden başlamaktadır. Sonuç olarak, aynı programın enerji tüketimi ikinci yürütmede daha fazla hesaplanmaktadır. Bu çalışmada, NVIDIA Jetson gömülü GPU'larda koşan uygulamaların güç ve enerji tüketimini doğru şekilde ölçmek için bir yöntem sunulmaktadır. Önerilen yöntem kullanılarak popüler birkaç evrişimsel sinir ağının çıkarım yaparken tükettiği güç ve enerji değerleri hesaplanmıştır. NVIDIA TensorRT optimizasyon seçeneklerinin ve NVIDIA Jetson TX2'de sunulan güç modlarının güç ve enerji tüketimi üzerindeki etkisi incelenmiştir.

Abstract:
Nowadays GPUs have become perfect deployment choices. Because they can afford greater computing performance and better energy efficiency. Energy consumption is an important design parameter for all embedded devices, especially battery powered devices. Power and energy consumption of many processor units have been investigated from past to present. Developers need accurate power measurements to enhance energy consumption of an application. However, it is not straightforward because behavior of a GPU is rather complex and not well documented. There are two methods for power measurement as direct and indirect measurement. External or internal power meters are used in direct measurement techniques. On the other hand, power consumption is estimated with a model in indirect measurement techniques. Artificial intelligence has been shifted to embedded devices known as edge devices. Edge devices offer solutions to two important problems: data privacy and latency. NVIDIA Jetson modules offer high performance with low power consumption for artificial intelligence applications. They are proper for high-performance applications where bandwidth and latency are critical. There are some challenges getting power measurements using built-in power sensor for NVIDIA Jetson TX2 GPU. For example, if a GPU kernel runs twice, the first execution starts at idle power level while the second execution starts at a higher level. As a result, calculated energy of same program is higher in the second execution. This study presents a methodology for true power and energy measurements of kernels running on NVIDIA Jetson family GPUs. Using the proposed method, power and energy consumed by some widely used deep neural networks while making inferences have been calculated. The effects of NVIDIA TensorRT optimizations and Jetson TX2 modes on power and energy consumption have been investigated. 

Target hardware in this study is NVIDIA Jetson TX2. It is built around Pascal family GPU. It supports four different power modes: MAXN, MAXQ, MAXP Core-All, and MAXP Core ARM. Power modes allow several configurations with different operating frequencies and active cores. Limiting CPU and GPU frequencies reduces power consumption of the module. Two optimized power modes are supported: MAXQ mode for maximum power efficiency and MAXP mode for power efficiency and speed balance. Hardware units are configured for maximum efficiency at MAXQ mode whereas performance is increased by sacrificing power at MAXP mode. On the other hand, there is no power limitation in MAXN mode. All CPU cores are active, and GPU runs at the highest frequency.

NVIDIA Jetson TX2 has an onboard TI-INA3221x power sensor chip. Instantaneous power consumption of units such as CPU, GPU, or SoC can be measured using built-in sensor. A microbenchmark named as MUL is designed to examine in detail the power consumption behavior of Jetson TX2 GPU. MUL kernel performs vector multiplication in a loop. Arithmetic logic unit (ALU) is stressed when running MUL kernel. While MUL kernel is running on Jetson GPU at MAX-N mode, a thread simultaneously reads power consumption on the CPU.

Power profile shows power consumption versus time. It has been investigated by
performing some experiments. Power has been monitoring before, during, and after execution of the kernel. Firstly, sampling times are not equal and mostly under 500 μs. Secondly, power doesn't increase and decrease immediately. When a kernel starts, computational activity on SMs immediately rises, remains constant during execution, and then immediately is set to zero. Power consumption depends on activities of SMs, and hence it is expected that power profile is similar to behavior of computational activity. But observed power profile has a delay at beginning of execution and a tail after end of execution. This difference between kernel activity and power profile causes an error on instant power and energy consumption of kernels. Thirdly, idle power is 152 mW and active idle power is 229 mW for Jetson TX2 GPU.

An equation proposed in literature has been implemented to eliminate difference between power and computational activity. The equation compensates delay and tail in power profile. Time constant in the equation has been found experimentally 415 ms for Jetson TX2 GPU. Then, true sampling period has been determined to eliminate redundant power measurements. Power consumption has been read with a constant period of 14 ms and the equation has been applied power measurements. As a result, a rectangular power profile like illustrated in the previous study couldn't be obtained.

The dissimilarity is due to sharp transitions between power measurements. Difference between consecutive power values is mostly 76 mW. It is occasionally twice as 76 mW and less than 10 mW. Digital filters can be used to smooth transitions. Moving average filter is a simple and practical method to reduce noise and provide smoothness for time domain signals. It is a kind of convolution operation. Convolution is a mathematical way of combining two signals to produce a third signal. Firstly, Simple Moving Average (SMA), Weighted Moving Average (WMA), Cumulative Moving Average (CMA) and Exponential Moving Average (EMA) filters have been applied to raw power data. Then Median and Savitzky–Golay (SAVGOL) filters have been applied to raw power data.

Window size has been designated as 9 by investigating smoothing effect of different window values. Firstly, filtered power values have been obtained after application of filters on raw measurements. Secondly, corrected power profiles have been obtained applying the equation. Then, they have been compared geometrically. 9-Point Simple Moving Average filter is the best to obtain a rectangular power profile. Multi-pass moving average filters enable an input signal to be passed through filter two or more times. It has been observed that corrected power profile gets close expected power profile after applying a multi-pass filter. Therefore, simple moving average filter has been applied 4 times to reduce wobbles in corrected profile.

The proposed method solves swelling in power and energy consumption of second execution. Power consumption of next kernel can be accurately measured without waiting for GPU to reach idle power. MUL kernel has been run on another GPU from Jetson family to validate the proposed method. Energy consumption has been calculated as 97.142 J with raw power values whereas 97.311 J with corrected power values. The difference between them is %0.17. Then a graph neural network has been run on Jetson TX2 GPU. Power consumption has been read when the model makes inferences. A rectangular power profile has been successfully achieved after the application of the proposed method.