项目作者: hobywan

项目描述 :
A profiling library based on PAPI hardware counters targetted for Linux-based multicore compute nodes.
高级语言: C++
项目地址: git://github.com/hobywan/wrappi.git
创建时间: 2019-04-10T12:22:47Z
项目社区:https://github.com/hobywan/wrappi

开源协议:MIT License

下载


logo

wrappi is a C++ library for core events profiling based on PAPI hardware counters.
It is targetted for multicore and manycore compute nodes endowed with a Linux kernel.
It provides a simple and clean interface to retrieve:

on a given section of the code, or for a set of compute kernels.

Build Status
Codacy Badge
license

Build and use

Build

wrappi is almost standalone.
It requires a C++14 compiler endowed with OpenMP.
It can be built on any Linux distribution with PAPI installed, using CMake:

  1. mkdir build # out-of-source build recommended
  2. cd build #
  3. cmake .. # CMAKE_BUILD_TYPE=[Debug|Release]
  4. make -j4 # use multiple jobs for compilation
  5. make install # optional, can use a prefix
Linking to your project

wrappi is exported as a package.
To enable it, please update your CMakeLists.txt with:

  1. find_package(wrappi) # in build or install tree
  2. target_link_libraries(target PRIVATE wrappi) # replace 'target'

And then include wrappi.h in your application.

Setting thread-core affinity

In a multicore context, you have to explicitly set thread-core affinity before profiling.
Indeed, threads should be bind to physical cores to prevent the OS from migrating them.
Besides, simultaneous multithreading (or hyperthreading on Intel) should be disabled in this case.
It can be done by setting some environment variables:

  1. export OMP_PLACES=core OMP_PROC_BIND=close # with Gnu or LLVM compiler
  2. export KMP_AFFINITY=[granularity=core,compact] # with Intel compiler
Basic usage

Codacy Badge

wrappi was designed with simplicity and ease of use in mind.
It can retrieve stats on each invidual core as well as for all cores.
Here is a basic usage:

  1. using namespace wrappi;
  2. Manager profile(Mode::Cache, nb);
  3. for (int i = 0; i < nb; ++i) {
  4. profile.start(i);
  5. kernel[i].run();
  6. profile.stop(i);
  7. }
  8. profile.dump();

You can profile cycles, caches, instructions, TLB, or any event supported by PAPI as well.

Contribute

license

wrappi extends the initial work of Sean Chester.

Improvements are welcome.
To get involved, you can:

  • report bugs or request features by submitting an issue.
  • submit code contributions using feature branches and pull requests.

Enjoy! 😊