Almost all events unrecognized with building with PAPI 32 bit

90 views
Skip to first unread message

Khaled Z Mahmoud

unread,
Feb 28, 2018, 3:41:17 PM2/28/18
to ptools-...@icl.utk.edu
Hi,

When building PAPI with "-m32" option, almost all events are not recognized at runtime. That , specifying --> "--with-bitmode=32.

PAPI_TOT_CYC for example is not recognized.
It should not make any difference which bit-mode is used. I assumed this is a bug in the API.

--
Regards,
Khaled Mahmoud

Khaled Z Mahmoud

unread,
Feb 28, 2018, 8:33:53 PM2/28/18
to ptools-...@icl.utk.edu
Hi,

In order to temporarily solve this problem here is what I did :

  • Edited line 2601 --- Modifed " BITFLAGS=-m64" to " BITFLAGS=-m32"
  • The "-m32" is added to LDGLAGS as well.

Using --with-bitmode=32 will generate errors at runtime. Most of PAPI events will be nu-recognized.

With this hack, most of the tests passed with 32-bits mode.


--
Regards,
Khaled Mahmoud

Vince Weaver

unread,
Mar 1, 2018, 10:58:48 AM3/1/18
to Khaled Z Mahmoud, ptools-...@icl.utk.edu
On Wed, 28 Feb 2018, Khaled Z Mahmoud wrote:

> Using --with-bitmode=32 will generate errors at runtime. Most of PAPI
> events will be nu-recognized.

you need to provide some more details here.

What architecture/machine are you testing on?

What events are not recognized compared to 64-bit? What errors are you
seeing?

Also, why are you compiling for 32-bit? Do you run on an architecture
that requires 32-bit support?

Vince

Khaled Z Mahmoud

unread,
Mar 1, 2018, 2:49:35 PM3/1/18
to Vince Weaver, ptools-...@icl.utk.edu
Why I want to build 32-bit version of PAPI ? I am integrating into Jikes Virtual Machine. Jikes currently support 32-bit version.

Below are the specifications of my system:
++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                20
On-line CPU(s) list:   0-19
Thread(s) per core:    2
Core(s) per socket:    10
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 79
Model name:            Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz
Stepping:              1
CPU MHz:               1200.000
CPU max MHz:           2201.0000
CPU min MHz:           1200.0000
BogoMIPS:              4390.05
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              25600K
NUMA node0 CPU(s):     0-19
Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdseed adx smap xsaveopt cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat p

--
Regards,
Khaled Mahmoud

Vince Weaver

unread,
Mar 1, 2018, 3:24:58 PM3/1/18
to Khaled Z Mahmoud, ptools-...@icl.utk.edu
On Thu, 1 Mar 2018, Khaled Z Mahmoud wrote:

> Why I want to build 32-bit version of PAPI ? I am integrating into Jikes
> Virtual Machine. Jikes currently support 32-bit version.

you said "all events unrecognized", what exactly do you mean by that?
Which events are failing?

Vince Weaver

unread,
Mar 1, 2018, 5:24:03 PM3/1/18
to Khaled Z Mahmoud, ptools-...@icl.utk.edu
On Thu, 1 Mar 2018, Khaled Z Mahmoud wrote:

> To be more accurate and specific, at least PAPI_TOT_CYC is not recognized.
> It returns "PAPI error -4" whenever you query the event.
> Also, when I run make fulltest ... Most tests return "PAPI error -4".

That doesn't sound like a 32-bit specific issue.

What does "papi_component_avail" report. I'm guessing this is the issue
with the perf_event_paranoid being set to 3 issue.

If your /proc/sys/kernel/perf_event_paranoid file has "3" in it, then as
root you'll want to set it to "0" or "1" in order for events to work.

Vince


Khaled Z Mahmoud

unread,
Mar 1, 2018, 6:24:53 PM3/1/18
to Vince Weaver, ptools-...@icl.utk.edu
The " /proc/sys/kernel/perf_event_paranoid" is already set to 0.


On Thu, Mar 1, 2018 at 5:34 PM, Khaled Z Mahmoud <kmah...@binghamton.edu> wrote:
I will try that. This problem only occurd with-m32 flag.  64 bit compilation has no issues.



--
Regards,
Khaled Mahmoud

Khaled Z Mahmoud

unread,
Nov 29, 2020, 3:40:16 AM11/29/20
to Vince Weaver, ptools-...@icl.utk.edu
Hi,

I am back to the project that uses the 32-bit version of PAPI after somehow a long pause.
PAPI-32 bit version was working, however, the change since then is that we had to reformat the server and re-install the operating system (We tried to make environment identical).

Now the issue is back again.

Here is the result of running “papi_component_available”. Appreciate any help or hint :(   :(.   :(

Compiled-in components:
Name:   perf_event              Linux perf_event CPU counters
   \-> Disabled: Unknown libpfm4 related error
Name:   perf_event_uncore       Linux perf_event CPU uncore and northbridge
   \-> Disabled: No uncore PMUs or events found

Active components:



On Mar 1, 2018, at 6:24 PM, Khaled Z Mahmoud <kmah...@binghamton.edu> wrote:

o

Khaled Z Mahmoud

unread,
Nov 29, 2020, 4:45:05 AM11/29/20
to Vince Weaver, ptools-perfapi
Hi,

I have installed papi again and trying to compile and reconfigure from the beginning.
As I am compiling, I am getting: 

mpicc -I../testlib -I../validation_tests -I.. -I.  -g -Wextra  -Wall -O1 -m32  first.c ../testlib/libtestlib.a ../testlib/do_loops.o ../libpapi.a -ldl  -m32 -o mpifirst
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi.so when searching for -lmpi

The mpi I have on the system is 64 bit version, while it needs 32 bit to work.

I know this is a more linux question, but you may have encountered a quick fix in PAPI.
Any hints can save a lot of time

Khaled Z Mahmoud

unread,
Nov 29, 2020, 8:50:24 PM11/29/20
to Vince Weaver, ptools-perfapi
Hi,

I have downloaded the openmpi library and compiled a 32bit version of
it :https://www.open-mpi.org/
I am planning to : Use the 32bit version of the openmpi library, not
the one that already exists on my system. I believe this would be the
safest option, to avoid crashing the server and replacing the 64bit
with a 32bit version.

I'll have to dig much deeper in the Make files and configuration to do this

Question: Can you provide instructions and details on how to do this ?
It will take me a while and some trial and error to figure it out.
From someone who probably built PAPI, I think it should be a quick
fix.

Thanks a lot





On Sun, Nov 29, 2020 at 4:45 AM Khaled Z Mahmoud
<kmah...@binghamton.edu> wrote:
>
> Hi,
>
> I have installed papi again and trying to compile and reconfigure from the beginning.
> As I am compiling, I am getting:
>
> mpicc -I../testlib -I../validation_tests -I.. -I. -g -Wextra -Wall -O1 -m32 first.c ../testlib/libtestlib.a ../testlib/do_loops.o ../libpapi.a -ldl -m32 -o mpifirst
> /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi.so when searching for -lmpi
>
> The mpi I have on the system is 64 bit version, while it needs 32 bit to work.
>
> I know this is a more linux question, but you may have encountered a quick fix in PAPI.
> Any hints can save a lot of time
>
>
> On Nov 29, 2020, at 3:40 AM, Khaled Z Mahmoud <kmah...@binghamton.edu> wrote:
>
> Hi,
>
> I am back to the project that uses the 32-bit version of PAPI after somehow a long pause.
> PAPI-32 bit version was working, however, the change since then is that we had to reformat the server and re-install the operating system (We tried to make environment identical).
>
> Now the issue is back again.
>
> Here is the result of running “papi_component_available”. Appreciate any help or hint :( :(. :(
>
> Compiled-in components:
> Name: perf_event Linux perf_event CPU counters
> \-> Disabled: Unknown libpfm4 related error
> Name: perf_event_uncore Linux perf_event CPU uncore and northbridge
> \-> Disabled: No uncore PMUs or events found
>
> Active components:
>
>
>
> On Mar 1, 2018, at 6:24 PM, Khaled Z Mahmoud <kmah...@binghamton.edu> wrote:
>
> o
>
>
>


--
Regards,
Khaled Mahmoud

Vince Weaver

unread,
Nov 29, 2020, 9:02:25 PM11/29/20
to Khaled Z Mahmoud, ptools-perfapi


you don't need mpi to build PAPI. It's only used for some of the test
suite.
Vince Weaver
vincent...@maine.edu
Associate Professor, Electrical and Computer Engineering
http://web.eece.maine.edu/~vweaver/

Khaled Z Mahmoud

unread,
Nov 30, 2020, 4:00:04 PM11/30/20
to Vince Weaver, ptools-perfapi
Hi,


I am able to run some the files inside c-tests. They all pass the initialization of PAPI API.

However, when I try to run PAPI from an external C app, I get PAPI error -4 upon initialization.


I do compile with gcc -m32 -lpapi whatevern.c”.

NOTE : I did make install after building pap

Vince Weaver

unread,
Nov 30, 2020, 5:13:00 PM11/30/20
to Khaled Z Mahmoud, ptools-perfapi
On Mon, 30 Nov 2020, Khaled Z Mahmoud wrote:

> I am able to run some the files inside c-tests. They all pass the
> initialization of PAPI API.
>
> However, when I try to run PAPI from an external C app, I get PAPI error
> -4 upon initialization.

you need to provide some more info
what version of PAPI are you running
what version of Linux are you running
what processor are you running on
this can all be found at the top of "papi_native_avail".

also why are you forcing PAPI to compile 32bit?

Khaled Z Mahmoud

unread,
Dec 1, 2020, 12:27:14 AM12/1/20
to Vince Weaver, ptools-perfapi
Hi,

After some further debugging … here is what I got:

This very method : PAPI_library_init(PAPI_VER_CURRENT) — Prints "PAPI error -4”.

However,

int retval=0;
if((retval=PAPI_library_init(PAPI_VER_CURRENT)) != PAPI_VER_CURRENT) {
printf("[sysInitPerf] Library Initialization Error! %d \n", retval);
handle_error(retval);
}



The code inside the if statement is never ever reached.
The question is right now ….. ….. Why it prints PAP error -4 ??? Is this an error ?

I got it work and compile busing the libpapi.a instead of -lpapi option when gcc.

As to the question why I am using 32 bit : I am working on JikesRVM which almost only supports 32 bit version.







available components and hardware information.
--------------------------------------------------------------------------------
PAPI version : 5.6.1.0
Operating system : Linux 4.9.0-12-amd64
Vendor string and code : GenuineIntel (1, 0x1)
Model string and code : Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz (79, 0x4f)
CPU revision : 1.000000
CPUID : Family/Model/Stepping 6/79/1, 0x06/0x4f/0x01
CPU Max MHz : 2201
CPU Min MHz : 1200
Total cores : 40
SMT threads per core : 2
Cores per socket : 10
Sockets : 2
Cores per NUMA region : 20
NUMA regions : 2
Running in a VM : no
Number Hardware Counters : 10
Max Multiplex Counters : 384
Fast counter read (rdpmc): no
--------------------------------------------------------------------------------

Compiled-in components:
Name: perf_event Linux perf_event CPU counters
Name: perf_event_uncore Linux perf_event CPU uncore and northbridge
\-> Disabled: Insufficient permissions for uncore access. Set /proc/sys/kernel/perf_event_paranoid to 0 or run as root.

Active components:
Name: perf_event Linux perf_event CPU counters
Native: 162, Preset: 60, Counters: 10
PMUs supported: ix86arch, perf, perf_raw, bdw_ep


--------------------------------------------------------------------------------
kmahmou1@jolteon:~/jikes/kjikes/JikesRVM-3.1.4$ sudo papi_component_avail
[sudo] password for kmahmou1:
Available components and hardware information.
--------------------------------------------------------------------------------
PAPI version : 5.6.1.0
Operating system : Linux 4.9.0-12-amd64
Vendor string and code : GenuineIntel (1, 0x1)
Model string and code : Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz (79, 0x4f)
CPU revision : 1.000000
CPUID : Family/Model/Stepping 6/79/1, 0x06/0x4f/0x01
CPU Max MHz : 2201
CPU Min MHz : 1200
Total cores : 40
SMT threads per core : 2
Cores per socket : 10
Sockets : 2
Cores per NUMA region : 20
NUMA regions : 2
Running in a VM : no
Number Hardware Counters : 10
Max Multiplex Counters : 384
Fast counter read (rdpmc): no
--------------------------------------------------------------------------------

Compiled-in components:
Name: perf_event Linux perf_event CPU counters
Name: perf_event_uncore Linux perf_event CPU uncore and northbridge

Active components:
Name: perf_event Linux perf_event CPU counters
Native: 231, Preset: 60, Counters: 10
PMUs supported: ix86arch, perf, perf_raw, bdw_ep

Name: perf_event_uncore Linux perf_event CPU uncore and northbridge
Native: 781, Preset: 0, Counters: 97
PMUs supported: rapl, bdx_unc_cbo0, bdx_unc_cbo1, bdx_unc_cbo2, bdx_unc_cbo3, bdx_unc_cbo4, bdx_unc_cbo5
bdx_unc_cbo6, bdx_unc_cbo7, bdx_unc_cbo8, bdx_unc_cbo9, bdx_unc_ha0, bdx_unc_imc0, bdx_unc_imc1
bdx_unc_imc2, bdx_unc_imc3, bdx_unc_imc4, bdx_unc_pcu, bdx_unc_qpi0, bdx_unc_qpi1, bdx_unc_ubo
bdx_unc_r2pcie, bdx_unc_r3qpi0, bdx_unc_r3qpi1

Khaled Z Mahmoud

unread,
Dec 1, 2020, 2:34:44 AM12/1/20
to Vince Weaver, ptools-perfapi
Hi,

I may have finally figured out the problem

When PAPI showed the -4 error, I included the -lpfm with build instructions. Without compiling with this option, PAPI will run and it will not generate the -4 error.

Here are my assumptions and understanding:
1- PAPI already comes with the source code of lib-perf and is built with it.
2- The final libpapi.a —> Will contain everything including libperf. So need to install anything globally. Just use libpapi.a
3- When I included -lpfm, some confusion occurs and weird things will happen because of the two perf versions.


I am hope now I am ready to go and will not face more issues :)

Khaled Z Mahmoud

unread,
Dec 17, 2020, 10:49:56 PM12/17/20
to Vince Weaver, ptools-perfapi
Hi,


I am trying to measure energy, I am rapl component is not found.
In the make file, I made sure I added rapl the COMPONENTS= line.


Am I missing any configuration here ?

Regards,
Khaled Mahmoud

Khaled Z Mahmoud

unread,
Dec 17, 2020, 11:09:05 PM12/17/20
to Vince Weaver, ptools-perfapi
The definition of rapl was missing from components_config.h.
Using the m32 flag introduced some difficulties … but hopefully getting there :)
Reply all
Reply to author
Forward
0 new messages