- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a question about the newly implemented parameterized derived types language feature:
If I use a KIND type parameter when specifying array DIMENSIONs of a DT component, and write special (typically type-bound) procedures for this PDT that operate on the said array component, will the compiler be able to optimize performance in any way due to array dimensions being known at compile time for all instances of the type?
Of course one could do the same without PDTs by just using a (global) PARAMETER in the declaration of the array dummy arguments and the array variables, but I guess that it would be much easier for the compiler til reason about this when it is "formalized" through a DT..?
PS: the array(-component)s I'm talking about here would typically be small; in the range 2x2 to 16x16
PS2: really looking forward to finally use PDTs!!!!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, you can do that. It's even an example in the standard (Note 4.23 in F2008). For optimization, it's no different than using a PARAMETER in the bounds expression.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can I interpret your reply to imply that procedures with array arguments of given/constant shape are actually optimized compared to if assume-shape dummies were used?
And, as we're on the subject; is there a difference (in speed/overhead/?) between assumed-shape and explicit-shape (where array bounds are passed as arguments) dummies?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Anytime information is deferred to run-time, there's a performance penalty. How large that is depends a lot on the application. Explicit shape arrays with bounds as dummy arguments are barely different from assumed-shape (except that the compiler knows the stride is always 1.)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page