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

Fortran compile flags for code coverage report

tsreins
Débutant
3 061 Visites

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 Compliments
5 Réponses
Mark_Lewy
Précieux contributeur I
3 016 Visites

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 Compliments
Barbara_P_Intel
Employé
2 994 Visites

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 Compliments
tsreins
Débutant
2 928 Visites

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

 

Thanks!

0 Compliments
Barbara_P_Intel
Employé
2 889 Visites

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 Compliments
Riccardo
Débutant
2 601 Visites

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 Compliments
Répondre