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

omp_lib.h is rather gruesome

Nick_M_3
New Contributor I
806 Views

I teach portable programming, and I both use and recommend all diagnostic options, including ones like -stand=f03.  Unfortunately, omp_lib.h is highly non-standard and (this is the point) that is not shielded from the user.  With this program:

PROGRAM Main
    IMPLICIT NONE
    INCLUDE "omp_lib.h"
END PROGRAM Main

and command ifort -stand=f03, I get a stream of diagnostics that will confuse the kiddies.  That's not good.

0 Kudos
5 Replies
Steven_L_Intel1
Employee
806 Views

Tell the kids to USE OMP_LIB instead. It's better for them.

Yes, include files that declare non-standard routines may use extensions. Looking through omp_lib.h, I think that many of the directives could be replaced with C interoperability features, but use of include files here are still likely to be an issue if you turn on standards warnings.

0 Kudos
Nick_M_3
New Contributor I
806 Views

Er, yes - stupid of me :-(

I copied the examples from one that I had written before the module was available in most compilers, and had completely forgotten about the module when I produced this report.  I will do a systematic update and check my lectures.  Thanks for that!

0 Kudos
mecej4
Honored Contributor III
806 Views

This sort of thing (older language features used in examples, header and include files, and described in documentation) is probably unavoidable. There was a thread in the MKL forum recently where an example code with Cray pointers was discussed, and some of the responders had never heard of Cray pointers. One person jokingly asked if the Cray pointer was a kind of Cajun dog.

Eventually, the examples and include files may get updated to use ISO C-Interoperability, but it will take time and effort.

0 Kudos
Nick_M_3
New Contributor I
806 Views

I certainly wish that people would forget about Cray pointers :- a zillion incompatible specifications, all with nightmarish consequences for software engineering and optimisation!

In this case, the module is the right solution, and it is only because I am one of the earlier users of OpenMP that I had code with the Fortran header in - had - I don't any longer :-)  I agree that improving the header is clearly significant effort and a low-priority task.

0 Kudos
Steven_L_Intel1
Employee
806 Views

And Nick, as you know, even Cray doesn't like the term!

0 Kudos
Reply