Help using PAPI for multi-threaded application

Open discussion of PAPI.

Help using PAPI for multi-threaded application

Postby prats_sri » Tue Jul 22, 2014 1:20 pm

Hi All,

I am new to PAPI. So far, I have tried to use PAPI for single-threaded applications and it has gone well so far. Now, I want to use PAPI for getting the performance counter values for a multi-threaded application. But I don't need statistics per thread, instead I need to get the statistics for the entire application. The multi-threaded application uses pthreads.

Till now, I have tried attaching to the process instead of instrumenting it, but it keeps crashing on me. I do not fork out the process, the process is already running, I get the PID of the process using the ps tool and the I tried attaching PAPI to the running application directly using this PID value. But it crashed.

So, I am thinking of instrumenting the code directly using PAPI and see if it would work. Can you give me some pointers as to how I can use PAPI to gather statistics for the entire multi-threaded process (not individual threads).

Thanks for your help.

- Prats
prats_sri
 
Posts: 3
Joined: Tue Jul 22, 2014 1:06 pm

Re: Help using PAPI for multi-threaded application

Postby James Ralph » Tue Jul 22, 2014 4:57 pm

Hi,

I'm not sure that there is a simple way to do what you want.
If you can, instrumenting each thread is reasonably easy to do.

See the pthrtough.c file in $(papi_src_dir)/ctests for a small example.

We have an inherit option (see PAPI_set_opt ) but I'm not sure that it works
for threads, I'll check and get back to you.

Hope that gets you started,
James
James Ralph
 
Posts: 20
Joined: Tue Aug 25, 2009 2:43 pm

Re: Help using PAPI for multi-threaded application

Postby prats_sri » Wed Jul 23, 2014 6:11 pm

Thanks James,

I will get started with the pthrtough.c example to instrument indivdual threads.

What is the inherit option used for?

Thanks,
Prats
prats_sri
 
Posts: 3
Joined: Tue Jul 22, 2014 1:06 pm

Re: Help using PAPI for multi-threaded application

Postby MrDalek » Thu May 28, 2015 9:33 pm

Hi James,

I am also interested in monitoring a multi-thread application. I tried using PAPI_inherit and PAPI_attach, but PAPI_read returns -3.

Is there a way to monitor all threads of a process that has been attached by its PID? If so can you provide an example (maybe based on inherit.c test code?)
MrDalek
 
Posts: 3
Joined: Thu May 28, 2015 9:03 pm


Return to General discussion (read-only)

Who is online

Users browsing this forum: No registered users and 1 guest