-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PATCH CATERPILLAR v4] Code instrumentation with PAPI library #406
[PATCH CATERPILLAR v4] Code instrumentation with PAPI library #406
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks very promising. General comments:
-
We should update the DEPENDENCIES file to include details about what's required to use PAPI.
-
The Travis file needs to be updated to include at least one run that enables this code so that it's actually compiled. We can't merge in code that is never compiled.
code_instrumentation=yes],[]) | ||
|
||
AC_SUBST([PAPI_PATH]) | ||
AM_CONDITIONAL([CODE_INSTRUM], [test x$code_instrumentation = xyes ]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PAPI enable/disable status should also be configured in the configure
summary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.
@@ -13,4 +13,8 @@ SUBDIRS = classifier \ | |||
ddf_ifs \ | |||
ddf_app | |||
|
|||
if CODE_INSTRUM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this get enabled/tested?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In 'example/m4/configure.m4' there is this conditional:
AM_CONDITIONAL([CODE_INSTRUM], [test x$code_instrumentation = xyes])
It is defined if PAPI path is set at configure time: --with-papi-path=DIR
We have similar arrangements for different pktios (netmap, etc)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please support bare --with-papi, so that one can use system-provided PAPI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, '--with-papi' will be added.
572be0a
to
c73b414
Compare
@@ -13,4 +13,8 @@ AM_CFLAGS = \ | |||
-I$(top_srcdir)/platform/@with_platform@/arch/@ARCH_DIR@ \ | |||
-I$(top_builddir)/include | |||
|
|||
if CODE_INSTRUM | |||
AM_LDFLAGS = -L$(LIB) -lssl -lcrypto -latomic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to pick up dynamic-examples-tests PR into your branch and then base this code on top.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need at this point (can be done at master ->caterpillar merge time). Most likely, #390 will get into Caterpillar before this PR.
example/instrum/Makefile.am
Outdated
$(srcdir)/papi_cnt.h \ | ||
$(srcdir)/init.h \ | ||
$(srcdir)/drv.h \ | ||
$(srcdir)/sched.h |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these headers used by anybody else? If not, you can just add them to _SOURCES. Also there is no need to specify $(srcdir) here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kind of expected to have *.h in noinst_HEADERS and *.c in _SOURCES.
$ ./configure --prefix=<papi_install_dir> | ||
$ make clean | ||
$ make | ||
$ make install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't apt-get install libpapi-dev / yum install / etc. enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't know. I was not able to get it for my Ubuntu. You should get something like 'libpfm4 libpapi5.4 libpapi-dev' or newer.
Also, you get different PAPI versions for different releases and don't know if they have backward compats.
The Bionic Beaver (active development) papi trunk series
5.6.0-1 release (universe) 2018-01-26
The Artful Aardvark (current stable release) papi trunk series
5.5.1-2 release (universe) 2017-05-09
The Xenial Xerus (supported) papi trunk series
5.4.3-2 release (universe) 2016-04-19
The Trusty Tahr (supported)
5.3.0-3 release (universe) 2014-02-05
@@ -202,6 +202,83 @@ Prerequisites for building the OpenDataPlane (ODP) API | |||
1024MB of memory: | |||
$ sudo ODP_PKTIO_DPDK_PARAMS="-m 1024" ./test/performance/odp_l2fwd -i 0 -c 1 | |||
|
|||
3.5 Code instrumentation with PAPI library (optional) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we are not enabling instrumentation in generic library code, maybe this text should go to example/instrum/README with a note here that we support PAPI instrumentation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am expecting to have more config time options in the future (symbols visibility, etc.) that will affect building of generic library code.
Also this PR should be applicable to master. Could you please reopen it against master? |
@Bill-Fischofer-Linaro I suspect we cannot really run PAPI in Travis due to PAPI limitations when running in VM. See this change: bogdanPricope@e902b14 See this result: It seems we can display available counters (PAPI events) but we cannot monitor them. |
@bogdanPricope It looks like you're getting output in the Raw Log:
Were you referring to the |
@Bill-Fischofer-Linaro That is the output of papi tool ‘papi_avail’. This looks fine and is no surprise: ‘instrum’ library is also able to initialize PAPI (PAPI_library_init()) and validate availability of the requested PAPI events (PAPI_query_event()) (+ other PAPI calls). My concern is about PAPI_add_events() that returns PAPI_ENOEVNT (-7): https://linux.die.net/man/3/papi_add_events “PAPI_ENOEVNT My best guess is related to this note: VMware and KVM both provide a virtual PMU given your configuration meets the requirements. This allows PAPI to function identically on the virtual machine guest operating system as on bare metal. Requirements are listed below.’ (http://icl.cs.utk.edu/projects/papi/wiki/PAPITopics:PAPI_on_Virtualization_Platforms) My understanding is that travis test is running under KVM and requirements are: ‘Host must be running Linux Kernel 3.3 or higher. |
@lumag There is not decision to integrate this in Tiger Moth (master). I will be happy if LNG people will try to use it and signal if is useful, etc. |
c73b414
to
bd44d56
Compare
@bogdanPricope Merging patches from caterpillar branch to master will take time. We can benefit from PAPI there before merging it. Also it would be nice to have performance measurements during merge period. |
I concur with @lumag's view that this can be helpful in guiding further merge/tuning decisions. Regarding KVM, do we know if we can get the prereq levels/configuration in Travis? Even with some limitations, it would seem limited PMU access would be beneficial. Something to discuss during tomorrow's call. |
Add configuration options to enable code instrumentation and set PAPI installation folder. Signed-off-by: Bogdan Pricope <bogdan.pricope@linaro.org>
Add instrumentation library as odp example. Signed-off-by: Bogdan Pricope <bogdan.pricope@linaro.org>
Use low level PAPI API to get performance counters. Exemplify on some ODP APIs. Signed-off-by: Bogdan Pricope <bogdan.pricope@linaro.org>
Configure the set of papi counters to be acquired via an environment variable. Signed-off-by: Bogdan Pricope <bogdan.pricope@linaro.org>
Add configure time option to trim API set to be instrumented. Signed-off-by: Bogdan Pricope <bogdan.pricope@linaro.org>
Describe configuration and requirements of code instrumentation library. Signed-off-by: Bogdan Pricope <bogdan.pricope@linaro.org>
Add test to validate ODP build with papi library. Signed-off-by: Bogdan Pricope <bogdan.pricope@linaro.org>
bd44d56
to
26ae2a7
Compare
Moved to master branch: #443 |
ODP API instrumentation with PAPI (Performance API) library (http://icl.cs.utk.edu/papi)
"instrum" example is using library preload, symbols overloading and PAPI to obtain performance counters (like data cache miss or conditional branch count) for execution of ODP API calls. Performance counters are saved in CSV file format and can be presented in a graphical form (with Excel or similar).
Build:
./bootstrap
./configure --with-papi-path=< path to papi install> --with-code-instrum-profile=<ddf|scheduler|all>
make clean
make
Configure path to papi install:
--with-papi-path= < path to papi install>
Configure instrumented ODP API:
--with-code-instrum-profile=<ddf|scheduler|all>
Default: all
Storage directory:
export ODP_INSTRUM_STORE_DIR= < folder to store csv files >
Default directory: /tmp
e.g.
export ODP_INSTRUM_STORE_DIR=/home/bopi/Work/linaro/store
Configure PAPI events set:
export ODP_INSTRUM_PAPI_EVENTS=
Default: PAPI_BR_CN,PAPI_L2_DCM
e.g:
export ODP_INSTRUM_PAPI_EVENTS=PAPI_BR_CN,PAPI_L2_DCM,PAPI_BR_UCN
Set load library path:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH::
e.g.
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/bopi/Work/linaro/odp/lib/.libs:/home/bopi/Work/linaro/papi_inst/lib
Run:
LD_PRELOAD=libinstrum.so.0.0.0 ./example/generator/.libs/odp_generator -I eth1 -m r -c 0x8