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

Fortran compile flags for code coverage report

tsreins
Beginner
1,070 Views

Good Day,

When using the intel oneAPI compiler, looking at equivalent flags to create code coverage for fortran. These steps worked for c/c++ - now looking for Fortran equivalent please:

c/c++ instructions:

1) build with cflags -O0 -prof-gen=srcpos

2) run tests

3) run profmerge

4) run codecov

 

Thanks!

0 Kudos
5 Replies
Mark_Lewy
Valued Contributor I
1,025 Views

Your steps should be similar for Fortran.

This is what I did on Windows/VS2019/IFORT a while ago :

1) Add /Qprof-gen:srcpos /Qcov-gen /Qprof-dir:path to all relevant projects. The path argument to /Qprof-dir must be the same for all projects to get a single pgopt.spi file.
2) Your program must exit via the end program statement to generate .dyn files. (i.e. I didn't get coverage when using STOP to exit).
 
0 Kudos
Barbara_P_Intel
Employee
1,003 Views

Be aware that code coverage is only available for ifort, not ifx.

ifort is deprecated and will be discontinued in late 2024. ifx is the new Intel Fortran Compiler. See this thread for more information.

0 Kudos
tsreins
Beginner
937 Views

Good day - why is code coverage no longer supported for ifx? What is the alternative solution Intel will be providing? 

 

Thanks!

0 Kudos
Barbara_P_Intel
Employee
898 Views

As you know, ifx uses LLVM as its code generator plus some Intel optimizations. LLVM does not implement a code coverage feature and Intel hasn't added it.

I'm not aware of other solutions. I asked the developers, too. They aren't aware of other solutions either.

 

0 Kudos
Riccardo
Beginner
610 Views

Hi Barbara, a quick search showed llvm-cov I believe that it should be possible to get it work with ifx. I would like to stress that reaching a high code coverage has become more and more important in the past few years, therefore this feature is very important.

 

Best regards,

Riccardo

 

0 Kudos
Reply