For a general explanation of energy measurement, check our webpage.
jRAPL works for Intel microarchitectures of Skylake, Haswell, Sandy Bridge, Sandy Bridge_ep (Server) and Ivy Bridge. Each architecture has different RAPL support.
-
Sandy Bridge/Ivy Bridge: uncore GPU, CPU and package support.
-
Skylake, Haswell, Sandy Bridge_ep: DRAM, CPU and package support.
You need check which one is your CPU architecture before you use jRAPL.
For more details about RAPL, check the main reference
JRAPL only supports Linux system which should be directly installed on your machine. So you cannot measure the energy consumption as well as the hardware counters information on virtual machine since jRAPL needs to access the real respective registers. It currently supports energy measurement and hardware counters measurements (Cache hits, cache references, TLB hits, TLB misses, page faults, and etc.). For more information about the hardware counters measurements, check reference. Instead of tool perf
on Linux which supports application level measurements. We supply APIs to measure those counters information with finer granularity in Java program.
- Energy check library uses the Linux kernel
msr
module. To use, type
sudo modprobe msr
- Perf counters check library depends on Libpfm4 (http://perfmon2.sourceforge.net/docs_v4.html) library. Therefore, you should go to libpfm with command
cd libpfm/
sudo make install
to install necessary libraries and header files on your system.
To generate energy measurement library for JNI, type
make lib_shared_CPUScaler
To generate hardware counter measurement library for JNI, type
make lib_shared_perfChecker
To generate both libraries for JNI, type
make all
Everytime you need root/sudo access to run the Java code in order to access RAPL MSR.
jRAPL includes the following methods, and it needs to be declared like the following before usage:
-
public native static int ProfileInit();
Initializes jRAPL. Just needs call once in the beginning. -
public native static String EnergyStatCheck();
It returns a string value, which contains the format of content like:socket1_gpu/dram_energy#socket1_cpu_energy#socket1_package_energy@socket2_gpu/dram_energy#socket2_cpu_energy#socket2_package_energy
. The character '#' seperates the energy information per the socket. Character '@' seperates different sockets. If it only has one socket, there is no '@'. -
public native static void ProfileDealloc();
: Free the memory initialized inProfileInit()
.
The EnergyCheckUtils.java
class provide a working sample on how to use jRAPL.
For Perf counter measurement, you don't need root/sudo access to run the library. It has a seperate set of APIs which include:
public native static void perfInit(int numEvents, int isSet);
public native static void singlePerfEventCheck(String eventNames);
public native static void groupPerfEventsCheck(String eventNames);
public native static void perfEnable();
public native static void perfDisable();
public native static void perfSingleRead(int id, long[] buffer);
public native static void perfMultRead(long[] buffer);
public native static long processSingleValue(long[] buffer);
public native static long[] processMultiValue(long[] buffer);
Energy check and perf counter check can be easily used by accessing helper classes: EnergyCheckUtils
and PerfCheckUtils
respectively.
Support microarchitectures of Skylake and Haswell. (Feb 13 2017)
Support perf hardware counter check. (May 01 2017)
Energy check only works for at most 2 sockets CPU.
- per-core perfcheckutils
- perf list to match PPEP
- two app config
- predetermined pkg scheduling
Want to contribute with code, documentation or bug report? That's great, check out the Issues page.
- Kenan Liu {[email protected]}
- video_processing: 35sec (0.3)
- rnn_serving: 0.026 sec (20) X
- sentiment X
- ml_training: 5.0sec (3.0)
- primes: 2sec (8)
- image_rotate: 0.8sec (20) X
- img-resize: 1sec? (20)
- linpack: 0.4sec 500% (1)
- matmul: 0.1sec (2.5)
- lr_serving: 8sec (1)
- cnn_serving: 11sec (1)
- markdown X
- ocr-img: 1.5
- Hierarchical controller at controller node (current)
- Online linear regression baseline?
- B^2, B gradients
- ml2 with adaptive gradient
- include DRAM power?
- re-collect training traces with sinusoidal
- re-train including dram power