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

General Fortran Questions

frank_m1
Beginner
677 Views
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?
0 Kudos
1 Solution
Steven_L_Intel1
Employee
677 Views
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.

View solution in original post

0 Kudos
2 Replies
Steven_L_Intel1
Employee
678 Views
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.
0 Kudos
frank_m1
Beginner
677 Views

Thank you.

0 Kudos
Reply