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

Code coverage when the main program is not a Fortran program

Arjen_Markus
Honored Contributor I
593 Views

We want to register the code coverage for a large Fortran library. This works fine, using the relevant compile option (-Qprof-gen:srcpos), when we use the library via a Fortran main program. However, to get the full functionality of the library it needs to cooperate with another library and the infrastructure we have for that has been implemented in C++.

Unfortunately, it appears that in this constellation the files that register the code coverage are not written (the *.dyn files).

Some details:

  • We run on Windows
  • The C++ compiler is MicroSoft Visual C++

The question now is: how can we arrange for the program to produce its coverage files anyway or is that not possible?

0 Kudos
1 Solution
Steve_Lionel
Black Belt Retired Employee
576 Views

The Intel code coverage feature does not handle code not compiled by Intel compilers. You should be getting .dyn files for the Fortran code. I don't think there's a requirement that the main program be compiled by an Intel compiler, but I am not certain.

View solution in original post

0 Kudos
6 Replies
Steve_Lionel
Black Belt Retired Employee
577 Views

The Intel code coverage feature does not handle code not compiled by Intel compilers. You should be getting .dyn files for the Fortran code. I don't think there's a requirement that the main program be compiled by an Intel compiler, but I am not certain.

0 Kudos
Arjen_Markus
Honored Contributor I
569 Views

Well, that is not what I infer from my experiments: I did one calculation with the C++ program as the driver, that produced no .dyn files. Repeating the same calculation with the Fortran program did produce them. I have also noticed that the execution of a STOP statement prevented these .dyn files from appearing.

I do not expect the C++ code to be covered ;), but if my observation is correct, I will have to look for a different solution.

0 Kudos
Arjen_Markus
Honored Contributor I
530 Views

I am pretty sure we don't - it is definitely worth a try! Thanks.

0 Kudos
Arjen_Markus
Honored Contributor I
517 Views

Oh, it seems I was wrong about the C++ program not producing the .dyn files. They simply appear in a rather unexpected directory.

Some details: I use the option "-Qprof-dir: ." and then the .dyn files appear in the directory holding the .vfproj file in question. I was used to the relevant .vfproj file to be the one of the main program and I searched for these files in the directories for the various libraries. But I forgot that we also have some rather general libraries and the .dyn files were written there. In both cases: with the original C++ program driving the library and with the pair for_rtl_init_/for_rtl_finish_ in place.

Okay, that makes it easier from the perspective of the C++ program ;).

Steve_Lionel
Black Belt Retired Employee
551 Views

Yes, a STOP would definitely prevent the .dyn file from appearing - I've seen that before. I don't know if it's possible to get the .dyn file if the main program isn't from an Intel compiler - perhaps someone else does.

0 Kudos
Reply