HotCarbon 2023

EnergAt: Fine-Grained Energy Attribution for Multi-Tenancy

Hongyu Hè, Michal Friedman (ETH); Theodoros Rekatsinas (Apple Inc.)

This transcript was made by AI. The open source speech recognition model Whisper (large-v3-turbo) transcribed the recording with faster-whisper. Names and technical terms were checked against the paper, but it can still contain mistakes. The recording is the reference.

0:00 Thanks. Yeah, good morning, everyone. I'm Hongyu, a master's student at ETH. First, I'd like to thank our organizers for setting up the remote presentation. Unfortunately, I couldn't make it to Boston in person with you, but I will try to make the presentation interactive and hope you would find it interesting as well. So please interrupt me if you have any questions or I'm frozen. Okay, so today I'm very excited to talk to you about our work, EnergAt: Fine-Grained Energy Attribution for Multi-Tenancy. This is a joint work with Michal and Theo. So as we've probably heard a million times, the end of Dennard scaling really means that although we can still jam more transistors or make bigger chips, we can't curb the voltage and therefore the power density, which is why everyone is concerned about energy consumption.

1:06 This has been exacerbated by, you know, the mighty AI models powered by a machine learning system, which are huge energy consumers themselves. In fact, I started this project because I was measuring the energy consumption of one of our machine learning pipelines, and the results didn't add up, which really got me into the nitty-gritty details of, you know, software energy measurements. And yeah, so we really want to improve the energy efficiency, for example, for on-device or edge computing scenarios. But if we want to, you know, face the monster, we have to see the monster clearly first, right? And also it can be a sensitive topic because of its, you know, social... Hongyu, so sorry to interrupt you, but your slides are not advancing. You're still seeing your title slide.

2:06 Oh, sorry. Let me reshare it again. Saying software energy. Is that the slide you're presenting? Yes, yes. Okay, go ahead. Okay, is it moving? Advance one slide just so that we know it works. We don't have to interrupt you again.

2:52 Yes. Maybe, sorry about this. Sorry, can you see my screen now? It just says, started screen sharing. Seems to be very slow. Do you have multiple monitors? Is that the problem? Yes, let me disconnect one of my monitors.

3:54 Is software energy. Can you advance the slide? Go to the next slide so we can make sure it works. Yes, I'm moving the slides. Does it work? It's stuck at the software energy. Okay. I'm very sorry about that.

4:20 Now it's moving. Yeah, okay. Sorry about this. Yeah, let me continue. So, yeah, it can be a sensitive topic because of its social and economic impacts. And we really want to get the calculation right here. So, what's software energy attribution? Well, it aims to determine the share of energy consumed by your program and only your program. So, we don't want other applications to temper our measurements. And although there are many, you know, useful tools that allow us to measure the energy of our software, they are using coarse-grained attribution model. By that, I mean, energy measurements are aggregated at the device level. Meaning that, for example, it's not considering the NUMA effect, which can include imbalance in resource allocation. And also, the energy accounting is, you know, at the process level, which, for example, doesn't take into account the different runtime statistics of each thread on different sockets.

5:44 And also, it's not closely tracking the runtime dynamics, because we know that threads and processes can be created and destroyed at runtime. And as shown in the figure, there are also prone to noisy neighbor effects in multi-tenant environments, where the measured energy of our program is influenced by that of others. Finally, also, the energy used by the attribution model itself is not separate from the energy measurement, which can lead to imprecise results. So, one of the primary culprits, if you like, is the coarse hardware support we're having. In fact, you know, heterogeneous or even disaggregated hardware is increasingly shared by many tenants in the cloud. But these devices doesn't, you know, natively support software or task-level energy attribution. For example, we have CPU, on the CPU, we have RAPL parameters, as previously introduced by previous speakers.

6:56 We have NVML on GPUs and XPE from Xilinx for FPGAs. So, the main message of this work is that fine-grained software energy attribution is still possible, even with coarse-grained hardware support. And, in turn, our contribution is threefold. First, we propose a thread-level NUMA-aware energy attribution model for CPU and DRAM in multi-tenant environments. Second, we conduct a range of experiments with a prototype implementation to demonstrate that our model is valid, effective, and a robust-to-noisy-neighbor effect.

7:51 Yeah, and lastly, we provide insight into the opportunities and challenges on the way to energy-aware heterogeneous clouds. Next, I will delve into every single equation on this slide to explain our theoretical model in detail. Well, probably not, because I don't want to make all of you go to sleep, especially in the early morning. So, instead, what I'd like to do is to, you know, instead introduce the high-level principles of our methods. And first, yeah, we differentiate the static power and the dynamic one, and the static power is explicitly sampled up front, and we only attribute the dynamic portion. Then, to achieve thread-level NUMA-aware energy attribution, we conduct a per-thread accounting conditioned on socket-level statistics. And to circumvent the noisy-neighbor effects, we introduce the concept of energy credits, which is based solely on the exclusive resource usage, meaning that we only consider the resources used by the target program, excluding that of the co-located tasks.

9:17 And, yeah, and lastly, we separate the energy consumption of the attribution model from the consumption, well, from the, but does our theoretical model work in practice? Well, as a proof of concept, we implemented a prototype called EnergAt, which is available on GitHub. And also, we constructed several microbenchmarks as the target applications. So, first, we have the CPU benchmark, which stresses the CPU utilization from 0% to 100% with equal number of threads and processes. Then, similarly, we have the memory benchmark, which sweeps the DRAM usage from 0% to 100% with one process. Then, we have the mixed benchmark, which keeps the CPU, both the CPU and DRAM, at around 50% utilization. And for the noisy-neighbor effects, we have the mixed-neighbor benchmark, which launches two mixed workloads, one as the target program, another as the noisy-neighbor.

10:38 And so, the objective here is really to, you know, cover all utilization levels and to emulate the noisy-neighbor effect. So, first, we want to validate our theoretical model and the prototype implementation. Since the direct validation of those fine-grained energy attribution model is impossible in practice, we conduct a so-called validation by summation. We conduct a so-called validation by summation, meaning that we trace all the energy, well, the energy provenance of all the programs running on our machine, including those microbenchmarks. And if the attributed energies amount to the total consumption of the machine, our method is indirectly validated. And we also modify our popular Firefox plugin, making it free-running as the reference value. First, let me explain the values in this figure. So, the total value here is the energy consumed by the machine in white and dark gray, measured by the plug-in and EnergAt, respectively.

11:51 And the attributed energy here is used by the corresponding microbenchmarks, the target programs, also measured by EnergAt, shown in light gray. And finally, the overhead here is the energy used by EnergAt itself in black. So, here I'd like to highlight three observations. First, the total value measured by EnergAt is equal to the reference value. And the sum of attributed energies plus the energy cost of the tool matches the total value as well. And addition, one addition observation, we can see that there is slight underestimation on the memory benchmark, which is because we are only considering the primary memory, sorry, the private memories, excluding the shared ones, for example, used by shared libraries, which are hard to reason about. Next, we compare our prototype with other tools.

12:59 So, this is a basic plot, so let me break it down. The category on the left are the microbenchmarks serving as the target application. And as before, these are the total energy consumption of the machine. Below are the energies attributed to different benchmarks by various tools. So, several observations I'd like to join here is that, first, we can see drastically different results from various tools. And also, we can see considerable, you know, underestimation as well as overestimation. And another observation here is that EnergAt is, you know, not affected by the addition of noisy neighbors. So, but our method is by no means perfect. So, and it has several limitations as well. Firstly, it's not considering other, you know, energy related factors, for example, shared memories, as I've mentioned, IO and caches.

14:12 And the challenge here is really to integrate external parameters with potentially various hardware interfaces. And the validation by summation that we talked about previously does not give insights into individual accounting, which the challenge here really lies in per entity validation of the energy attribution model. And we believe that simulation could be of help here, for example, using gem5, but we need to be cautious about the added error margin or margin by the simulation. And also, our prototype implementation still has non negligible energy overhead. This is because of the fine grain tracing and frequent, you know, counter sampling. We believe that this can be mitigated through more optimized implementation. For example, different counters have not are always of the same importance, right? They can, they could be sampled at different sampling rates.

15:13 And also, we want to evaluate our model on realistic benchmarks, which brings us to our final slide. I'd like to talk about the next steps we believe should be taken to achieve energy aware heterogeneous cloud environments. First, I believe that it's really helpful to have secure and efficient hardware and software interface for energy reporting. And this could enable us to sample counters with non-privileged permission and to propagate counter values in a virtualized environment. Secondly, we believe that, you know, energy attribution for cloud services and heterogeneous devices is extremely useful. And this can really enable, you know, energy-based billing in the cloud. But cloud services like serverless or machine learning as a service are far from the hardware, which makes them quite challenging. And tracing energy provenance among layers of virtualization is also quite difficult, much more difficult than doing it on a bare metal machine.

16:23 And the third point is that although we have proposed this fine-grained energy attribution model, it's really hard to, well, how to leverage this information still remains an open question. For example, should we run our programs on different cores on the same socket or on a different socket on the same machine? And finally, we believe that it's worth revisiting the energy efficiency of traditional algorithms and data structures, which are typically optimized solely for performance. That concludes my talk. Please feel free to check out our paper and code. And big shout out to Shell for his help in revising the manuscript. And thank you very much for your attention. And I'd like to take any questions. So we can do one question and I'm going to bring the mic to you as well.

17:26 They won't hear the questions on Zoom. Yeah, I have a couple of questions. Actually, we can, we're starting the 25-minute session right now, right? Oh, you have another topic. Okay, sorry. How do you actually do the attribution? Do you factor in sharing of sockets, multiple applications using the same socket? And in this case, how do you actually do the attribution? What's the model to different applications? So what is the input and output? How do you do this? Okay, I see. Thanks very much for the question. I have a couple of backup slides. Yes. So these, so in terms of energy attribution model, we sample various counters. So for example, we're sampling, we're using the RAPL parameters. We are getting the CPU and DRAM energy from various applications.

18:29 And specifically we are sampling the like per task or per thread CPU time as the proxy. And we are using conditional probability to estimate the residence rate of each thread on different socket in order to do per socket attribution. Does that answer your question? Yes, sort of. So I also don't understand the validation by summation is sounds to me that it's not going to validate that you're actually splitting the power across multiple applications in the right way, because by definition, it's going to sum up to the total, right? Yes. Yes. Yes. That's a great question. You're completely right. So we actually struggled a lot in validation because as you said, this like a validation by summation is not like validating every single entity that we are tracking in our model.

19:30 And it's quite difficult because in practice, it's really hard. It's really hard to find the ground truth for each and every application. And this has been mentioned in prior work that it's impossible to validate like for each and every entity. That's why, yeah, we are using the validation by summation. But as I've mentioned, maybe like simulation could be of help here because you have a whole picture and you have the clouds, sorry, the clocks. But yeah, like the simulation error could be another layer of complexity here. Okay. Yeah. So I just, just a final note. I'm not sure if you're aware, there is an open source project that is called Kepler, K-E-P-L-E-R, that is attempting something similar. So I just encourage you to take a look.

20:21 Okay. Thank you very much for the point. I have noted done and I will check it out. Thank you. Okay. So let's thank Hongyu one more time. Okay.