- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Which is faster, in place operations or not in place operations?
e.x.
c = a + b
or
a = a + b
How would I use Allocateso thatthe address of the first element of an arrayis divisible in bytes by 16, 32 or 64?
e.x.
c = a + b
or
a = a + b
How would I use Allocateso thatthe address of the first element of an arrayis divisible in bytes by 16, 32 or 64?
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your first question does not have a simple answer, other than "It depends". My advice is to write the code that is clearest to you and let the compiler worry about optimization. If you're talking scalars, I doubt you could ever detect a difference between these - with arrays, you might get into memory bandwidth issues with a separate target.
You can request alignment of allocatable variables by adding the directive:
!DEC$ ATTRIBUTES ALIGN:16 :: varname
replace 16 by 32 or 64 or whatever reasonable power of 2 you want. See the documentation on this directive for more details.
You can request alignment of allocatable variables by adding the directive:
!DEC$ ATTRIBUTES ALIGN:16 :: varname
replace 16 by 32 or 64 or whatever reasonable power of 2 you want. See the documentation on this directive for more details.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your first question does not have a simple answer, other than "It depends". My advice is to write the code that is clearest to you and let the compiler worry about optimization. If you're talking scalars, I doubt you could ever detect a difference between these - with arrays, you might get into memory bandwidth issues with a separate target.
You can request alignment of allocatable variables by adding the directive:
!DEC$ ATTRIBUTES ALIGN:16 :: varname
replace 16 by 32 or 64 or whatever reasonable power of 2 you want. See the documentation on this directive for more details.
You can request alignment of allocatable variables by adding the directive:
!DEC$ ATTRIBUTES ALIGN:16 :: varname
replace 16 by 32 or 64 or whatever reasonable power of 2 you want. See the documentation on this directive for more details.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page