I apologise if the issue that I am facing has already been discussed and addressed before.
I have installed papi-5.3.0 on my Linux UBUNTU machine (8 cores Intel(R) Xeon(R) CPU E5-1620 0 @ 3.60GHz).
I use 'rapl' component to measure power. My application which calls PAPI_Library_init and PAPI_shutdown as follows throws SIGSEGV:
- Code: Select all
int main() {
PAPI_library_init(PAPI_VER_CURRENT);
/* Find RAPL component */
/* Create event set */
PAPI_start(eventSet);
/* Execute a user function */
/* cleanup event set */
/* destroy event set */
PAPI_shutdown();
[color=#FF0000] PAPI_library_init(PAPI_VER_CURRENT);[/color] /* SIGSEGV happens here */
/* Find RAPL component */
/* Create event set */
PAPI_start(eventSet);
/* Execute a user function */
/* cleanup event set */
/* destroy event set */
PAPI_shutdown();
}
As you can see, I am calling PAPI_library_init() and then PAPI_shutdown() to free all the resources and then I call PAPI_library_init() again.
The valgrind output shows "invalid read" errors, which are reproduced below:
==26654== Invalid read of size 8
==26654== at 0x4A22CE: pfm_perf_get_event_attr_info (pfmlib_perf_event_pmu.c:736)
==26654== by 0x49EDDF: pfmlib_build_event_pattrs (pfmlib_common.c:961)
==26654== by 0x4A0529: pfm_get_event_info (pfmlib_common.c:1576)
==26654== by 0x497C21: allocate_native_event (pe_libpfm4_events.c:171)
==26654== by 0x497FE4: _pe_libpfm4_ntv_name_to_code (pe_libpfm4_events.c:816)
==26654== by 0x493079: _papi_load_preset_table (papi_preset.c:492)
==26654== by 0x4990D0: _pe_libpfm4_init (pe_libpfm4_events.c:1427)
==26654== by 0x4964AB: _pe_init_component (perf_event.c:1606)
==26654== by 0x48C37B: _papi_hwi_init_global (papi_internal.c:1705)
==26654== by 0x48A0C4: PAPI_library_init (papi.c:612)
...
==26654== Address 0x8b9a2b0 is 0 bytes after a block of size 131,072 alloc'd
==26654== at 0x4C2CE8E: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==26654== by 0x4A1238: perf_table_alloc_umask (pfmlib_perf_event_pmu.c:295)
==26654== by 0x4A1640: gen_tracepoint_table (pfmlib_perf_event_pmu.c:417)
==26654== by 0x4A1896: pfm_perf_init (pfmlib_perf_event_pmu.c:490)
==26654== by 0x49E167: pfmlib_pmu_activate (pfmlib_common.c:545)
==26654== by 0x49E38E: pfmlib_init_pmus (pfmlib_common.c:626)
==26654== by 0x49E523: pfm_initialize (pfmlib_common.c:689)
==26654== by 0x4AAEB4: _papi_libpfm4_init (papi_libpfm4_events.c:105)
==26654== by 0x49648A: _pe_init_component (perf_event.c:1599)
==26654== by 0x48C37B: _papi_hwi_init_global (papi_internal.c:1705)
==26654== by 0x48A0C4: PAPI_library_init (papi.c:612)
==26654==
==26654==
==26654== Process terminating with default action of signal 11 (SIGSEGV)
==26654== Access not within mapped region at address 0x125FCAB0
==26654== at 0x4A22CE: pfm_perf_get_event_attr_info (pfmlib_perf_event_pmu.c:736)
==26654== by 0x49EDDF: pfmlib_build_event_pattrs (pfmlib_common.c:961)
==26654== by 0x4A0529: pfm_get_event_info (pfmlib_common.c:1576)
==26654== by 0x497C21: allocate_native_event (pe_libpfm4_events.c:171)
==26654== by 0x497FE4: _pe_libpfm4_ntv_name_to_code (pe_libpfm4_events.c:816)
==26654== by 0x493079: _papi_load_preset_table (papi_preset.c:492)
==26654== by 0x4990D0: _pe_libpfm4_init (pe_libpfm4_events.c:1427)
==26654== by 0x4964AB: _pe_init_component (perf_event.c:1606)
==26654== by 0x48C37B: _papi_hwi_init_global (papi_internal.c:1705)
==26654== by 0x48A0C4: PAPI_library_init (papi.c:612)
Please let me know if my use of the PAPI functions is erroneous.
Thanks a lot for your help.
Best Regards
Manumachu
