pgprof stuck at the end of the execution

Hi,

I have a simple fortran code that I compile with

[angelv@deimos f90]$ make
pgfortran -fast -g -pg matrix.F90 -c -o matrix.o
pgfortran -fast -g -pg vector.F90 -c -o vector.o
pgfortran -fast -g -pg main.F90 -c -o main.o
pgfortran -o cg.x -fast -g -pg matrix.o vector.o main.o

The code itself takes just around 35 seconds to run if I do ./cg.x

but if I try to profile it, it gets stuck after finishing the calculations, never returning the prompt:

[angelv@deimos f90]$ pgprof -o cg.out ./cg.x
 Rows:      8120601 nnz:    218535025
Iteration:  0 Tolerance: 4.006700E+08
Iteration: 10 Tolerance: 1.877230E+07
Iteration: 20 Tolerance: 6.435887E+05
Iteration: 30 Tolerance: 2.320219E+04
Iteration: 40 Tolerance: 8.356487E+02
Iteration: 50 Tolerance: 3.003893E+01
Iteration: 60 Tolerance: 1.076441E+00
Iteration: 70 Tolerance: 3.836034E-02
Iteration: 80 Tolerance: 1.351503E-03
Iteration: 90 Tolerance: 4.620883E-05
 Total Iterations:          100 Time (s):    37.86828

The versions in my system are:

FC26
gcc: 7.3.1
glibc: 2.25
pgi: 18.1-1

Any idea if this can be solved?

Many thanks,
AdV

Hi,

If you type ‘pgprof --version’ what is your output?

[angelv@deimos]$ pgprof --version     
pgprof 18.1      
PGI Compilers and Tools

What are the dates on the copyright?

Copyright (c) 2017, NVIDIA CORPORATION.  All rights reserved.

You have the latest version enabled.

Can you post the Fortran source code or a link to a download? PGPROF should finish profiling the application only a few seconds after the program exits.

Hi,

sorry for taking so long to reply. I uploaded the code to FileNurse (https://goo.gl/uuufhL), since I don’t think I can upload code here in the Forum (it will be available only for 7 days, if you need it later, please let me know and I will upload it again.

There is a Makefile as well.

I just tried again, and the same thing happens in this machine: the executable without pgprof works fine and it takes around 40seconds to complete. When running with pgprof (pgprof -o cg.out ./cg.x) the code runs and I see all the output, but it never ends and I cannot see any profiling information.

Any help will be appreciated. Thanks,

Thanks for the upload. Using it I can verify that removing the ‘-pg’ option from your compile line will solve your problem. No additional options are required for profiling using pgprof.

Ah, sorry, the -pg option… OK, didn’t realize that, many thanks.

But now, I’m trying to use the Visual profiler, and I manage to run the code OK, I can see the generated output in the Console Tab and the time stats in the “CPU details” tab, but as you can see in the image uploaded at https://goo.gl/RrPjnG , I don’t get any timeline, neither source code. Am I also forgetting something obvious?

Many thanks,
AdV

You have everything, the timeline only shows GPU or OpenACC events. CPU profiling data is all in the CPU details tab.

By double-clicking on a event, like ‘matrix_mod_matvec_’ the source code viewer will be opened at that function.

Hi,

thanks for the reply. It is true, if I get OpenACC code, then I can see the timeline without trouble (I don’t know if the behaviour has changed from previous versions or if I got confused by the menu text bubble that says " Run application to generate CPU and GPU timeline").

But I cannot get to work the source code viewer. I have compiled the code with just -O0 and also with -O0 -g, but in both cases pgprof behaves the same way: nothing happens when I double-click on the ‘matrix_mod_matvec_’ in the CPU-details tab, and as you can see in https://goo.gl/NSEk1k an empty rectangle shows when I hover over this routine (which I guess it should really show the name of the file and the line where it is defined?).

When I compile a code with OpenACC, the events in the timeline do show the file name and line number, but double-clicking on them also doesn’t open the source code viewer.

Any ideas?

Thanks,
AdV

Can you send a link to the profile file?

Hi,

here it is: https://filenurse.com/download/8139a826892bb04a6a2830fe51d18e86.html

(I just recompiled the code, verified that I can run the profiler with it and see the timing information for the kernels, etc. but for some reason I don’t seem to be able to access the source code at all.

Any help appreciated,
AdV

If you first select ‘Thread 0’ in the thread selector drop-down menu (instead of ‘All threads’). Then double click on ‘matrix_mod_matvec_’ does the source tab or a dialog box appear?

Hi Scott,

no, the same behaviour after selecting “Thread 0”: an empty rectangle on hovering over ‘matrix_mod_matvec_’ and nothing happens when I double click on it.

Thanks,
AdV

What do you get when you click on the ‘Show Code Structure’ tab in the CPU details view? This is what I get–do you see something similar?

https://drive.google.com/file/d/1Zpb-Y-39IdwuAeyEzJyNWUHoUQEfdpyY/view?usp=sharing

Yes, what I see is basically the same https://i.imgur.com/PeikybU.png

But if I double click in the selected line no source code is opened. BUT, before writing this I was really puzzled, because I did manage to get the source code opened, I have no idea how/why, I compiled the code the same way, and as far as I can see I’m using the profiler in the same way (I have tried both running the code from inside the profiler and also generating the profile file first and then loading that .prof file in pgprof). Somehow, before I could get the source code view (but only once out of I don’t know how many trials), and now I’m back to the behaviour described in this thread: I cannot get any source code window open.

Thanks,
AdV