Skip to content

Latest commit

 

History

History
76 lines (67 loc) · 1.75 KB

README.md

File metadata and controls

76 lines (67 loc) · 1.75 KB

CPP Joules

Energy Measurement tool for CPP/CUDA programs

  • Uses Intel RAPL interface to get energy values
  • Uses NVML interface for getting GPU energy values
  • Needs read access to powercap in linux
  • Needs a 64bit windows system with nvml in system32

Installation Instructions

Linux

  • To use without installing into lib folder
chmod +x installer.sh
./installer.sh
  • Install to lib (requires cmake and make)
  mkdir build
  cd build
  cmake ..
  sudo cmake --build . --target install

Windows

.\installer.bat
  • cppJoules folder will be added
  • Can be included as #include "cppJoules/include/cppJoules.h" //Relative path
  • To use with g++, nvcc use -lCPP_Joules along with -L./cppJoules to add this path to linker search
  • Keep a copy of the dll along with you .exe file to run

Usage

#include "cppJoules/include/cppJoules.h"
int main()
{
  EnergyTracker tracker;
  tracker.start();
  // Code Snippet Here 
  tracker.stop();
  tracker.calculate_energy();
  tracker.print_energy();
  return 0;
}

To compile example file filename.cpp

  g++ filename.cpp -lCPP_Joules -L./cppJoules

Common Errors

  • undefined refrence

    /usr/bin/ld: /usr/local/lib/libCPP_Joules.so: undefined reference to `dlopen'
    /usr/bin/ld: /usr/local/lib/libCPP_Joules.so: undefined reference to `dlsym'
    
    • Use -ldl in the compile options
  • cppJoules not found

    • Add -L/path/to/file
    • Example -L./cppJoules
  • rapl domains are not visible

    • set read access to the sockets
    • One way would be to
      sudo chmod +r -R /sys/class/powercap/  
      
      Make sure to remove access after experiments.