# Agnostic Energy Consumption Models for Heterogeneous GPUs in Cloud Computing
## 3 Power and Energy Models
### Input Selection
Thus, we follow [12; 33] to develop the candidacy algorithm by using the correlation analysis to find the collection of hardware performance counters that have a reasonable correlation with power consumption in each GPU and assess this way of selecting the model's inputs. The candidacy algorithm consists of two main phases. Phase 1 aims to find the main performance counters in each GPU that have an impact on power consumption. In the CUDA programming language, there are several implementations to handle the GPU memory types, such as global, shared, and texture memories. The basic implementation for dealing with GPU memories is global memory, which is used in Phase 1. In this phase, we aim to reduce the nvprof profiling tool overhead since we found that some of the training set applications have a significant time delay when the profiling tool is executed. The output of Phase 1 is used as an input for Phase 2. Phase 2 aims to find the performance counters that have a notable impact on power consumption on applications located in the training set. The algorithm's inputs are all existing performance counters in each GPU (Fermi and Kepler) and all the applications considered in the training set. The algorithm's output is performance counter sets that have reasonable impacts on power consumption that will be used to train the model. In Phase 1, the matrix size is gradually increased starting from 480 \(\times\) 480 up to 2560 \(\times\) 2560 with a regular increase, to analyze the number of threads per block in terms of power. This increase creates eight different matrix sizes. Then, the power consumption and the performance counter values of each matrix size are profiled. Once the profiling of the power consumption and values of certain performance counters in all the matrices is completed, the level of strength between them is measured. The Pearson correlation coefficient is applied to evaluate the strength of the relationship between the power consumption and the performance counter values. The Pearson correlation coefficient aims to measure the linear correlation between two variables sets X and Y between \(-1\) and \(1\). When the absolute value of the coefficient is \(1\) or close to \(1\), this means that there is a linear high correlation. In [33], the authors selected the top 10 performance counters that have a strong correlation with GPU power consumption. However, since we consider two heterogeneous GPUs containing different features, we initially selected the hardware performance counters that are greater or equal to \(0.5\) as a predefined threshold that represents the middle of the value between \(0\) and \(1\), as mentioned in [34]. After applying the Pearson correlation coefficient, a threshold is set to select the Pearson coefficient \(Pt_{c}\) (line 14). The outcome of Phase 1 is the \(FC\) set which includes the essential performance counter metrics that are greater than the assigned \(0.5\), and the \(FC\) set will be used as an input for the second phase. Similar to Phase 1, the power consumption and the performance counter value of each application in the training set that contains 30 applications are profiled. After profiling the power consumption and performance counters values, another Pearson correlation coefficient \(Pt2_{c}\) is applied between the counter value and the profiled power consumption in all applications in the training set. After applying the correlation analysis in Phase 2, we found that there is low overlapping in the correlation relationship between the selected performance counters and power consumption. The reason behind this low overlapping in Phase 2 is that we applied the Pearson correlation coefficient on 30 applications with different sizes and different characteristics to find the strength of the relationship between each selected performance counter and power consumption.