PAPI and OpenMP

201 views
Skip to first unread message

Henrique Rennó

unread,
Jul 30, 2018, 10:31:36 AM7/30/18
to ptools-perfapi
Hello, I'm trying to read hardware counters with PAPI for OpenMP threads. The following C code does not seem to work as the values for the first thread are fine, but for the second thread are not. What is the right use of PAPI and OpenMP? Code is attached. I'd appreciate any help. Thanks in advance.

This code is compiled with (for a PAPI default installation): icc -I/usr/local/include -L/usr/local/lib -lpapi -qopenmp -o teste_papith.xc teste_papith.c

Output:
84279296 84279296
0 0
id = 0, time = 0.000067, event[0] = 105, x = 24975000
id = 0, time = 0.000067, event[1] = 165, x = 24975000
id = 1, time = 0.000058, event[0] = 140419991043152, x = 99950000
id = 1, time = 0.000058, event[1] = 140420010960080, x = 99950000

teste_papith.c

Frank Winkler

unread,
Jul 30, 2018, 12:13:15 PM7/30/18
to Henrique Rennó, ptools-perfapi
Hi Henrique,

You need an event set for each thread!
With "PAPI_start_counters" you created an event set for the main thread.
You could try to call "PAPI_start_counters()" inside your parallel region or just use the low-level API.

BTW:
There will be a new high-level API soon that makes this kind of PAPI instrumentation much easier.
I will test it with your example and come back to you soon!

Thanks,
Frank

--
You received this message because you are subscribed to the Google Groups "ptools-perfapi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ptools-perfap...@icl.utk.edu.
To post to this group, send email to ptools-...@icl.utk.edu.
Visit this group at https://groups.google.com/a/icl.utk.edu/group/ptools-perfapi/.
<teste_papith.c>

__________________________________________________________
Frank Winkler, M.Sc.

Technische Universität Dresden
Center for Information Services and
High Performance Computing (ZIH)
01062 Dresden, Germany

Contact:
Willers-Bau, Room A106
Phone:    +49 351 463-35630
Fax:        +49 351 463-38245
Email:     frank....@tu-dresden.de
WWW:    http://www.tu-dresden.de/zih

Reply all
Reply to author
Forward
0 new messages