Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29233 Discussions

Using IVF Code Coverage tools - some queries

srinivasa_karanam
789 Views
Dear All:
Let me confess right off the bat that FORTRAN is not my cup of tea. 
However, I am very much interested into Agile Software development. 
I was excited to learn about the Code Coverage tool in IVF. I thought 
of applying this tool to good use for our product but started with a 
prototype. The sample program is attached along with this post. The 
HTML code coverage analysis file was already generated. The sample 
application has two .f90 files and tool appears to be doing most of 
the job. However, I am having difficulty understanding the following
issues:
1. How can calculate the number of BLOCKS?
2. From the main program, I had intentionally commented out 
!   Call Pump
However, this line of code comes up with GREEN color as if it 
   is executed. 
3. In the following piece of code in COLUMN subroutine (in UOP.F90),
   the folor coding is very confusing. It shows that the IF condition 
   is only partially executed which does not appear to be correct.
     if (iidata(1).eq.1) then
        ^ 1 ^ 1 (1/3)
            rrdata(1) = 100.d0
            ^ 2 (2)
    10) endif
4. When I applied the CodeCoverage tool for my product, all the lines 
   of code with "C" in the first column (FORTRAN 77 standard). I would 
   expect Code Coverage tool to leave out these lines. However, all 
   lines of code which are "comments" is shown as if they got executed.
   I am not sure if this problem skews the coverage statistics for
   the application.
   
I would greatly apprecite your response.
RAO
0 Kudos
5 Replies
Steven_L_Intel1
Employee
789 Views
Welcome to the forum!

I am not an expert in the code coverage tool, but I think I can explain some of this. The coverage tool does not operate on a line-by-line basis. Rather, it looks at code blocks which are sequences of instructions that have a single entry and single exit. When the source is annotated, any comment lines are included between the first executed line and the last executed line in the block. This is why the comments are shown in green. If you look at the analysis for UOP.F90, you'll see that the entire subroutine PUMP is colored pink indicating that it was never executed.

I don't know how you compiled this, but if the compiler could determine, in routine COLUMN, that IIDATA(1) was always 1, it would not need to execute the test and would unconditionally execute the body of the IF. That's what it appears to have done. If you used /Qipo it could have done this.

The number of blocks can be viewed in the report - you can't really calculate this in advance.
0 Kudos
Steven_L_Intel1
Employee
789 Views
I took another look at your project and it is buult without optimization. The IF test is executed, so I am not sure why the expression is marked as not executed.
0 Kudos
srinivasa_karanam
789 Views

Hello Steve:

I apologize for the late reply as I have been travelling. Thanks a lot for your clarifications regarding comments being show as green or pink depending upon weather the code block is being executed or not.

As mentioned before, I have started deploying the tool to our project. One problem that I am facing is with Static libraries. The following is the structure of our project.

MyApp.exe - C/C++ (starting point to launch the application, not much stuff)

MyCalc.DLL - C/C++ (just a DLL that exports relevant functions in FORTRAN static libraries listed below where algorithms are coded)

Pump.lib (FORTRAN static lib project built with /Qprof_gen)

Column.lib (FORTRAN static lib project built with /Qprof_gen)

Compressor.lib (FORTRAN static lib project built with /Qprof_gen)

The idea would be to get code coverage for all FORTRAN files that are part of these static libraries when our regression spanning thousands of files are run. However, for reasons that I do not understand, I get the .dyn and HTML Code Coverage report file generated only for one static library, namely, Pump.lib. I tried this experimentation involving several more static libraries and it always seems to be static lib that starts with latest alphabet (just a guess!!).

Thanks and Regards,

Rao

0 Kudos
Steven_L_Intel1
Employee
789 Views
Is MyApp.exe also built with /Qprof_gen? I'd think that was required.

I'd suggest you submit an issue to Intel Support and attach an example project that shows the problem. This way experts in the code coverage tool will be able to help you. I've used this feature for simple cases but don't have a deep understanding of it.
0 Kudos
srinivasa_karanam
789 Views

Thanks for your response. As per your suggestion, I built a proto-type using one of the example that comes with IVF. I am also submitting the same for Intel Technical support team through our point of contact. I am uploading the same here for other members benefit. I will post any reply that I get from Technical support team.

The program has a main program which is C++ based (does not understand /Qprof_gen) and two FORTRAN static libraries, FLIB and GLIB with Code Coverage enabled for both. When you execute, *.dyn files is produced only in GLIB folder and not in FLIB.

Thanks,

Rao

0 Kudos
Reply