Package: energat
EnergAt 🔋🎯EnergAt is a prototype implementation of the thread-level, NUMA-aware energy attribution model for multi-tenancy, as proposed in ourpaper. It offers precise tracking of the energy consumption of your software application, even when it is running alongside other jobs from different users.InstallTo use EnergAt, the following requirements have to be met:Python 3.10Linux with root permissionIntel RAPL with sysfs power capping interfaceNoteThere are several ways of accessing RAPL meters on Linux (e.g., via model-specific registers or perf), but the current implementation only supports the powercap interface.Contributionsare more than welcome!Please run the following commands:# * Configure the host system.$./scripts/setup/init_system.sh# * Use root permission for invoking energat with `sudo` later.$sudopython-mpipinstallenergatUsageWarningPlease always first estimate the static power of the machine by running the following command.$sudoenergat-basepowerPython APIimportpsutil,timefromenergat.tracerimportEnergyTracerdefxyz():tmp=20_000for_inrange(100):time.sleep(0.1)tmp=tmp*0.314withEnergyTracer(psutil.Process().pid,output='xyz_energy')astracer:xyz()# * The traces of `xyz()` will be saved to ./xyz_energy.csv at this point.Command line interfaceFirst, check the system setup by running:$sudoenergat-check

EnergAt@Jul0310:30:27]INFO|Socketcount:2EnergAt@Jul0310:30:27]INFO|HostCPUtimes:[334541.14,334861.87]EnergAt@Jul0310:30:27]INFO|TotalNUMAmemories:[32094.24,32211.02]EnergAt@Jul0310:30:27]INFO|RAPLdomainranges:[262143.32885,65712.999613]EnergAt@Jul0310:30:27]INFO|Systemcheckpassed!Then, you can attach EnergAt to a running application for which you want to trace the energy consumption by providing its PID:$sudoenergat-pid<PID>Other command-line options include:$sudoenergat[FLAGS]Commands:--pid PID                PID of the target application(default: -1)--name NAME              Name of the target application--check                  Check hardware support(default: False)--basepower              Estimate static power(default: False)Configurations:--output OUTPUT          Output directory(default: ./data/results)--basefile BASEFILE      File recording the baseline power(default: ./data/baseline_power.json)--base_period BASE_PERIODSampling period in seconds for baseline power estimation(default: 2)--rapl_period RAPL_PERIODSampling period in seconds for RAPL power meters(default: 0.01)--interval INTERVAL      Interval in seconds between two power estimations(default: 1)--gamma GAMMA            Non-linear scaling factor for CPU power(default: 0.3)--delta DELTA            Non-linear scaling factor for DRAM power(default: 0.2)--logging LOGGING        Logging interval in seconds (with `loglvl=debug` only)(default: 1)--loglvl LOGLVL          Logging level (info/debug)(default: debug)Once the target application finishes, EnergAt will save the energy traces to the-outputdirectory and exits. You can also stop the tracing byCtrl+C, and EnergAt will still save your result before exiting.DevelopmentEnergAt has been heavily tested on a few dual- and single-socket machines on CloudLab.To set up the development environment, please run the following commands.# * Run the setup script../scripts/setup/init_cloudlab.sh# * Install python dependencies.pipinstall-rrequirements.txt# * Configure git hooks.pipinstallpre-commit
pre-commitinstall
pre-commitautoupdateRuntime ConfigurationThere are several ways by which you can change the configurations of EnergAt:Directly change the default parameters inconfigs/default.py.Provide your own config file in theconfigs/directory and specify it in the command line, e.g.,:$sudoenergat-config=./configs/your_config.pyOverwrite the default parameters through command-line flags, e.g.,:$sudoenergat-config.OUTPUT_DIR='./out'-config.DELTA_MEM=0.1ContributingPull requests (PRs) are most welcome! Please follow the PR template:.github/pull_request_template.md.CitationIf you find this tool useful, please cite our paper:@inproceedings{hotcarbon2023energat,
  author = {Hè, Hongyu and Friedman, Michal and Rekatsinas, Theodoros},
  title = {EnergAt: Fine-Grained Energy Attribution for Multi-Tenancy},
  booktitle = {2nd Workshop on Sustainable Computer Systems (HotCarbon '23)},
  year = {2023},
  month = {July},
  day = {9},
  location = {Boston, MA, USA},
  publisher = {ACM},
  address = {New York, NY, USA},
  pages = {8},
  doi = {10.1145/3604930.3605716},
  url = {https://doi.org/10.1145/3604930.3605716}
}