I'm working through my old code to improve its performance and running GAP. The reports often suggest I add !dir$ loop count min(XXX) to the code. Although I reckon that more often than not the loop count will exceed XXX, I cant guarantee it. I have therefore added IF loops to the code along the lines of the following example
Assume A and B are vectors of the same size
IF (SIZE(A) > 255)
!DIR$ LOOP COUNT MIN(256)
B=A
ELSE
B=A
END IF
This strikes me as pretty ugly and will have a small performance penalty as the IF loop is tested.
Alternately I could write
!DIR$ PARALLEL ALWAYS
B=A
Is there a better way and which approach to coding is considered the best? Will the computation provide the wrong answer if I set loop count min and at run time there are less iterations to do or will it just be inefficient?
Cheers
Kim