Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Table of Contents | ||||||
---|---|---|---|---|---|---|
|
Introduction
This page deals with vectorization and optimization of OpenRadioss Fortran code. This is a fundamental aspect of the code that needs to be well understood and learned by new OpenRadioss contributors. New functionality should be developed taking into account the same level of care regarding performance
Vectorization
Expand | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Vector LengthMost computations like element or contact forces, are performed by packets of New treatments need to respect this programming model which is to split the loop over number of elements or nodes by packets of Loop Control
Inside a loop it is recommended to keep the number of instructions reasonable Calling a procedure inside a loop inhibits vectorization Data DependencyThe loop below is not vectorized due to possible dependence (same value of
In case of no true dependence, vectorization needs to be forced by adding a compiler directive To keep portability across different platforms and compilers, an architecture specific include file exists named vectorize.inc that manages vectorization directives. The programmer just needs to add this include file just before the
Notice there is another include file named simd.inc which makes unconditional vectorization, even if a true dependence is detected by the compiler. It is recommended to only use vectorise.inc which is more conservative regarding correctness |
Arithmetic Functions
Expand | ||||||
---|---|---|---|---|---|---|
PowerNever use real variable for integer power because of the cost of real power arithmetic. Take care to not use real variable defined in constant.inc when integer is enough
|
Arrays
Expand | |||||
---|---|---|---|---|---|
Fortran90 Array OperationsUse of Fortran90 array operations is encouraged as long as code readability is kept by always specifying array bounds Example:
Multidimensional ArraysData LocalityLarge arrays over a number of nodes or elements are defined to maximize data locality and have therefore the smallest dimension first, like in the example below: Rule of thumb for data locality of 2D arrays:
Structure Of ArraysUse structure of arrays |
Object Oriented Programming
It is not recommended to use object-oriented features unless you can verify that it does not harm performance