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

Feature request: Relaxed !DIR$ ASSUME placement

New Contributor II

I'd like to log a new feature request: I'm really liking the ability to pass hints to the optimizer about the size limits of certain variables, etc.  However, inserting this directive in a header appears to trigger a switch in the syntax parser from the definition section to the executable section.  This makes it a bit of a Achilles' heel in practical usage for us, as it would be rather convenient to co-locate the ASSUME hints for a variable in the same location it is defined.

Example: You have a file that include ~5 different header files that define a series of structures, arrays, loop-control variables, etc.   These files may be included in several hundred compilation units, so locating the !DIR$ ASSUME tunings for the loop-control variables in the same headers where they are defined would be much easier than having to edit the hundreds of compilation units to ensure the ASSUME directives lie after all the variable definitions.


0 Kudos
2 Replies
Honored Contributor III

Perhaps this is a job for FPP?

You would need to use #include as opposed INCLUDE (sans #)


appropriately #define the values you want.

For numeric-only values you might be able to use an INTEGER PRAGMA ...

Jim Dempsey

0 Kudos
New Contributor II
I'm unclear on your proposed solution. We already have converted over to using the preprocessor-style #include statements, but I don't follow how using macros will solve the sequencing issue with the placement of the ASSUME directive. I suppose we could put all of our ASSUME directive in a single macro that is expanded by the preprocessor, but the request was just that the parser relax its placement rules for the !DIR$ ASSUME directive so it can be intermixed with the variable definitions. Even though it isn't mentioned in the documentation, it seems as though it's required to be in the executable section of code and not the variable definition section.
0 Kudos