RJoules, a tool designed to measure the energy consumption of code snippets written in R. It is a wrapper interface developed on top of Intel RAPL, enabling the logging of energy traces directly from the operating system
STEP1: Clone or download this github repository:
git clone https://github.com/rishalab/RJoules.git
STEP2: Navigate into the RJoules_main directory, copy the path of energy_measurement.R
cd RJoules/RJoules_main
pwd
For testing we have provided few test files here. Take any of the test file and update the PATH following STEP3 and run the below commands
cd RJoules/Test_files
R<TESTFILENAME.R
STEP3: If you want to measure energy in your R script. Create a R script example. R and Import/source RJoules
source("PATH/energy_measurement.R")
STEP4: Write the code for which energy measurements need to be done inside a function block as below example in example.R.
test_foo<-function(){
print("This is my foo function..")
df <- data.frame("Age" = c(12, 21, 15, 5, 25), "Name" = c("Johnny", "Glen", "Alfie","Jack", "Finch"))
newdf <- df[order(df$Age), ]
print(newdf)
}
STEP5: Call measure_energy function defined in RJoules with test function name as parameter
measure_energy(test_foo)()
STEP6: Run example.R in console to get Energy measurements
R<example.R --no-save>
STEP7: Check the output in output.csv file
vi output.csv
Measuring energy consumption due to R code snippets.
RJoules uses intel-RAPL interface to measure energy consumption. The tool is developed for getting package and dram domain energy consumption due to R code snippet. The internal workflow is described in the below figure.
Rajrupa chattaraj, Sridhar Chimalakonda