Visible to Intel only — GUID: GUID-179A38EE-4D40-4EB6-9717-4B625DDB1C27
Visible to Intel only — GUID: GUID-179A38EE-4D40-4EB6-9717-4B625DDB1C27
SIMD Directive for OpenMP
OpenMP* Fortran Compiler Directive: Transforms a loop into a loop that will be executed concurrently using Single Instruction Multiple Data (SIMD) instructions.
!$OMP SIMD [clause[[,] clause]... ]
do-loop
[!$OMP END SIMD]
clause |
Is one of the following:
|
do-loop |
Is one or more DO iterations (DO loops). The DO iteration cannot be a DO WHILE or a DO loop without loop control. The DO loop iteration variable must be of type integer. All loops associated with the construct must be structured and perfectly nested; that is, there must be no intervening code and no other OpenMP* Fortran directives between any two loops. The iterations of the DO loop are distributed across the existing team of threads. The values of the loop control parameters of the DO loop associated with a DO directive must be the same for all the threads in the team. You cannot branch out of a DO loop associated with a SIMD directive. |
A SIMD construct binds to the current task region. The binding thread set of the SIMD region is the current team.
If used, the END SIMD directive must appear immediately after the end of the loop. If you do not specify an END SIMD directive, an END SIMD directive is assumed at the end of do-loop.
The SIMD construct enables the execution of multiple iterations of the associated loops concurrently by means of SIMD instructions. No other OpenMP* Fortran construct can appear in a SIMD directive.
A SIMD region binds to the current task region. The binding thread set of the SIMD region is the current team.
When any thread encounters a SIMD construct, the iterations of the loop associated with the construct may be executed concurrently using the SIMD lanes that are available to the thread.
If an ORDERED directive with the SIMD clause is specified inside the SIMD region, the ordered regions encountered by any thread will use only a single SIMD lane to execute the ordered regions in the order of the loop iterations.
The following is an example using the SIMD directive:
subroutine subr(a, b, c, n)
implicit none
real(kind=kind(0.0d0)),dimension(*) :: a, b, c
integer :: n, i
!$omp simd
do i = 1, n
a(i) = a(i) * b(i) + c(i)
end do
end subroutine
The following example demonstrates the EARLY_EXIT clause:
!$omp simd early_exit
do i = 1, n
if (a(i) == i) exit
enddo