Cypress CSC-1200T Guide de l'utilisateur Page 47

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 124
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 46
Chapter 5. Fortran programming 47
a(j,i) = b(j,i) + 1
a(j,i+1) = b(j,i+1) + 1
END DO
END DO
Here we used the inverse operation of loop splitting to decrease the
overhead due to loop control.
Bottom loading is an effective technique for overlapping loop control
and loading of operands for the next iteration of the loop. Here is an
example:
DOi=1,100
a(i) = a(i) + b(i)*c(i)
END DO
After each iteration, one has to check whether to do further iterations, or
to continue from the next statement after the loop. When the statement
a(i) = a(i) + b(i)*c(i)
is executed, one has to issue load operations for the a(i), b(i) and
c(i) values, which can take some time. Therefore, one could start the
load operations for the next iteration first, and only after this check if
we should do another iteration.
Bottom loading can cause a program error if we try to load, for example,
the value c(101), which could be outside the memory allocated to the
program. In practice this never occurs, except in cases where the loop
has a large increment:
DOi=0,10000, 1000
a(i) = a(i) + b(i)*c(i)
END DO
Here we could load the value c(11000), which could be outside the
memory bounds.
The cache_align directive can be used to align arrays or COMMON blocks
on cache line boundaries:
REAL, DIMENSION(50) :: a, b
REAL, DIMENSION(10) :: c
COMMON /my_block/ a, b
!dir$ cache_align /my_block/, c
Here both the contents of the COMMON block my_block and the array c
were aligned on the cache line boundary. Therefore the array elements
a(1) and c(1) map to the first word of a cache line.
The directives bounds and nobounds tell the compiler to check specific
array references for out-of-bounds errors:
!dir$ bounds [array_name [, array_name]...]
!dir$ nobounds [array_name [, array_name]...]
If the array names are not supplied, the directive applies to all arrays.
Vue de la page 46
1 2 ... 42 43 44 45 46 47 48 49 50 51 52 ... 123 124

Commentaires sur ces manuels

Pas de commentaire