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

Using "shared memory" from within Fortran programs

orgabit
Beginner
633 Views
HI @all,

I am new here and currently evaluating the Intel Fortran Compiler to be used in a migration project where I am asked to migrate an HP1000 Fortran application (the HP1000 is an obsoleted real-time computer platform from HP with an O/S called RTE) to Linux. I downloaded the Fortran compiler (evaluation license) and got some tests programs compiled and linked successfully.

Now to the big question: on the HP1000, there was a feature which enabled programs/processes to share data (same like shared memory on *ix systems) by defining COMMON blocks to be shared (this feature was called Shareable EMA).

Is there a feature coming with the Intel Fortran compiler which gives me the same thing? If not, how could this be implemented: sharing COMMON block between running processes?

Another question: is it possible to "pre-include" a Fortran include file, i.e., tell the Compiler to include a file before the actual file is compiled?

Thanks for your help and
Best Regards,

Andreas
0 Kudos
2 Replies
jimdempseyatthecove
Honored Contributor III
633 Views
Andreas,

Someone else will have to answer the shared memory issue.

For "pre-include"

Why not make a Fortran "source" containing

! widgit
include 'PreIncludeFile.inc"
include 'mainFileForWidgit.f90'"


Then have your make file compile the stubs.

Alternate method

Alter make file to compilecomposit file built with cat or other concatination method.

Jim

0 Kudos
Tim_Gallagher
New Contributor II
633 Views
You can also tell the compiler to use fpp (the fortran equivalent to cpp) to process macros like C:

#include "PreIncludeFile.inc"

If you want the compiler to auto-detect when to do this, make the extension .F or .F90 (instead of .f or .f90). There's also a command line argument that could be used, but I don't recall what it is.

The only advantage of this method over using the Fortran INCLUDE line as given above is that you can use all the features of macro expansion and definitions as you would in C such as:

#ifdef DOUBLE_PREC
INTEGER :: wp = SELECTED_REAL_KIND(8)
#else
INTEGER :: wp = SELECTED_REAL_KIND(4)
#endif

Tim
0 Kudos
Reply