CodeGreen:迈向软件能耗测量精度与可移植性的改进
CodeGreen: Towards Improving Precision and Portability in Software Energy Measurement
AI总结:
CodeGreen通过异步生产者-消费者架构实现能耗测量模块化,支持多种硬件和语言,验证显示其与RAPL的高相关性,实现了高精度与跨平台的结合。
摘要:
准确的软件能耗测量对于优化能耗至关重要,但现有分析器在硬件或语言耦合紧密时迫使在测量精度和开销之间做出取舍。我们提出了CodeGreen,一个模块化的能耗测量平台,通过异步生产者-消费者架构将仪器化与测量解耦。我们实现了原生能耗测量后端(NEMB),独立地轮询硬件传感器(Intel RAPL、NVIDIA NVML、AMD ROCm),同时轻量级时间戳标记实现可调粒度。CodeGreen利用Tree-sitter AST查询在Python、C++、C和Java上实现自动化仪器化,可轻松扩展到任何Tree-sitter支持的语法,使开发者能够针对特定范围(循环、方法、类)而无需手动干预。对“计算机语言基准测试游戏”的验证显示,与RAPL地面真实值的相关性为R²=0.9934,与能耗-工作负载线性度为R²=0.9997。通过将细粒度测量精度与跨平台可移植性相结合,CodeGreen在异构环境中实现了实用的算法能耗优化。源代码、视频演示和文档可在https://smart-dal.github.io/codegreen/上公开获取。
英文摘要:
Accurate software energy measurement is critical for optimizing energy, yet existing profilers force a trade-off between measurement accuracy and overhead due to tight coupling with supported specific hardware or languages. We present CodeGreen, a modular energy measurement platform that decouples instrumentation from measurement via an asynchronous producer-consumer architecture. We implement a Native Energy Measurement Backend (NEMB) that polls hardware sensors (Intel RAPL, NVIDIA NVML, AMD ROCm) independently, while lightweight timestamp markers enable tunable granularity. CodeGreen leverages Tree-sitter AST queries for automated instrumentation across Python, C++, C, and Java, with straightforward extension to any Tree-sitter-supported grammar, enabling developers to target specific scopes (loops, methods, classes) without manual intervention. Validation against "Computer Language Benchmarks Game" demonstrates $R^2 = 0.9934$ correlation with RAPL ground truth and $R^2 = 0.9997$ energy-workload linearity. By bridging fine-grained measurement precision with cross-platform portability, CodeGreen enables practical algorithmic energy optimization across heterogeneous environments. Source code, video demonstration, and documentation for the tool are publicly available at: https://smart-dal.github.io/codegreen/.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。