DOI: 10.6084/m9.figshare.29336132
title: Lua-Performance-Paper.zip

description: <pre><b>Experiments details</b><br>- CPU baseline temperature: 32.2°C<br>- Number of times: 10<br><br><b>Requirements</b><br>- Debian-based Linux distributions<br>- Intel processor (compatible with RAPL)<br>- Non-containerized environment<br>- Docker (only to install LuaJIT-Remake)<br><br><b>Required Libraries</b><br>1. RAPL<br>2. lm-sensors<br>3. Powercap<br>4. Raplcap<br><br><b>Install all dependencies by running:</b><br><br>```bash<br>sudo bash scripts/install.sh<br>```<br><br><b>Prerequisites and Configuration</b><br>Before running measurements, you need to configure the following:<br><br><b>1. Wi-Fi Interface Configuration</b><br>The measurement script will automatically disable Wi-Fi during measurements to reduce interference. You need to set your Wi-Fi interface name in the script:<br><br>1. Find your Wi-Fi interface name:<br>```bash<br>ip link show | grep -E "wl|wifi"<br>```<br><br>2. Edit `scripts/measure.sh` and update line 4:<br>```bash<br>WIFI_INTERFACE="your_interface_name" # e.g., "wlp2s0", "wlan0", "wlo1"<br>```<br><br><b>2. System Permissions</b><br>The script requires sudo privileges for:<br>- Wi-Fi interface control<br>- RAPL energy measurements<br><br><b>3. Environment Variables</b><br>Ensure the following environment variable is set:<br>```bash<br>export LANG=C.UTF-8<br>```<br><br><b>4. Power Caps Configuration</b>This repository supports power capping. Since power capping is not a focus of this paper, set the `POWER_CAPS` array to `(-1)`.<br><br>```bash<br>POWER_CAPS=(-1)<br>```<br><br>-----------------------------------------//<br><br><b>Running RAPL Measurements</b><br><b>Important: </b>Ensure you have completed the Prerequisites and Configuration section above before running measurements.<br><br>To generate energy consumption measurements for all programs in all languages, run:<br><br>```bash<br>sudo -E bash scripts/measure.sh [language2] ... | all<br>```<br>- Replace [language2] ... with one or more of the supported languages listed below, or use all to run measurements for every supported language.<br>- Supported languages: All supported languages correspond to the folders listed in the `Languages/` directory.<br><br>This script will append the results to a top-level `measurements.csv` file.<br><br><b>Example usages:</b><br>```bash<br># Measure all supported languages<br>sudo -E bash scripts/measure.sh all<br><br># Measure only C and Lua_JIT<br>sudo -E bash scripts/measure.sh C "Lua_JIT"<br>```<br>If a specified language or directory is not found, the script will exit with an error message.<br><br><b>Automatic System Restoration</b><br>The measurement script automatically handles system cleanup:<br>-<b> Wi-Fi:</b> Automatically restored when the script completes or encounters an error<br>- <b>Error handling:</b> System settings are restored even if the script is interrupted (Ctrl+C) or crashes<br><br>This ensures your system won't be left in a dimmed state or with Wi-Fi disabled if something goes wrong during measurements.<br><br>-----------------------------------------//<br><br><b>Temperature Calibration</b><br><br>To calibrate the average CPU core temperature, execute the following:<br><br>```bash<br>cd RAPL<br>make<br>./main --temperature-calibration XX<br>```<br><br>Replace `XX` with the number of seconds to idle (sleep) before measuring the temperature.<br>The output will be saved to `/tmp/cores_temperature.txt`.<br><br>---<br><br><b>Powercap Calibration</b><br><br>As previously stated, this repository supports power capping. Since power capping is not a focus of this paper, we will not detail the power cap calibration process, even though it is implemented in this framework. If you are curious to determine the most energy-efficient power cap setting for your system (according to the `Package` energy consumption), you must specify custom programs for calibration. The tool supports both compiled and interpreted languages. Run the following commands for more details:<br><br>```bash<br>cd RAPL<br>make<br>./main --help<br>```<br><br><b>Parametrized Execution</b><br><br>To perform energy measurements on a specific program, use the following syntax:<br><br>```bash<br>./main <br>```<br><br><b>Arguments</b><br><br><b>Argument: Description </b> <br>``: The command to execute (e.g., `./my_program`) <br>``: Programming language (e.g., `C`, `Python`) <br>``: Name of the program being tested <br>``: Number of times to execute the program (must be &gt; 0) <br>``: Acceptable temperature variance (in Celsius, must be ≥ 0 <br>``: Timeout limit per execution (in minutes, must be &gt; 0) <br>``: Idle time before execution (in seconds, must be ≥ 0) <br>``: Power cap in watts (-1 for no power cap, or &gt; 0 for power cap) <br><br><b>Examples</b><br><br>```bash<br>cd RAPL<br>make<br><br># Run with 15W power cap<br>sudo -E ./main "./my_program" C my_program 5 3 20 10 15<br><br># Run without power cap (set to -1)<br>sudo -E ./main "./my_program" C my_program 5 3 20 10 -1<br><br># Python example with 20W power cap<br>sudo -E ./main "python3 script.py" Python script 3 5 30 5 20<br>```<br><br>The first example will:<br>- Perform idle measurement for 10 seconds<br>- Execute the program 5 times with a 15W power cap<br>- Add 3°C to the temperature variance <br>- Terminate executions exceeding 20 minutes<br><br>-----------------------------------------//<br><br><b>CSV Output Format</b><br><br>The `measurements.csv` contains the following columns:<br> <br>Language: Programming language <br>Program: Program name <br>Powercap: Power cap value applied (Watts) <br>Package: Energy used by the full socket (cores + GPU + other components) <br>Core: Energy used by CPU cores and caches <br>GPU: Energy used by GPU <br>DRAM: Energy used by RAM <br>Time: Execution time (in milliseconds) <br>Temperature: Average core temperature (in Celsius) <br>Memory: Total physical memory used (in KBytes) <br><br>-----------------------------------------//<br><br><b>Makefile Target Explanation</b><br><br>This document explains each target in the Makefiles used to build and evaluate several programs.<br><br><b>1. `compile`</b><br><br>**Command:**<br>```sh<br>make compile<br>```<br><br>Compiles the source code into an optimized executable binary (when possible).<br><br><b>2. `run`</b><br><br>**Command:**<br>```sh<br>make run<br>```<br><br>Runs the program - either runs a executable binary or runs a interpreted program.<br><br>**Command executed:**<br>```sh<br>./my_program [input]<br>```<br><br><b>3. `measure`</b><br><br>**Command:**<br>```sh<br>make measure<br>```<br><br>**Purpose:** <br>Measures energy consumption and executing time by running the program using the RAPL interface.<br><br>**Command breakdown:**<br>```sh<br>sudo ./main "./my_program [input]" [language] [program] $(n_times) $(variance) $(time_out_limit) $(sleep_secs)<br>```<br><br><b>4. `clean`</b><br><br>**Command:**<br>```sh<br>make clean<br>```<br><br>Removes generated files and cleans up the project directory.<br><br></pre>