Intel® Fortran Compiler 18.0 Developer Guide and Reference

OFFLOAD BEGIN and END OFFLOAD

OFFLOAD Compiler Directives: Enable a group of statements to execute on the target. These directives only apply when targeting Intel® Xeon Phi™ products.

!DIR$ OFFLOAD BEGIN clause[[,] clause...]

   block

!DIR$ END OFFLOAD

clause

Can be any of the clauses accepted by the OFFLOAD directive with identical meanings and restrictions.

block

Is a structured block (section) of statements or constructs. You cannot branch into or out of the block.

These directives provide the same functionality as the OFFLOAD directive, except that they let you offload a block of code that includes any number of Fortran statements, including DO, CALL and any assignments, but not OpenMP* directives.

The OFFLOAD BEGIN directive must be paired with a closing END OFFLOAD directive.

Example

In the following example, the DO loop is designated for offloading.

subroutine sample()
...
!DIR$ OFFLOAD BEGIN TARGET(MIC)
   do i = 1, n
      a(i) = b(i) ** 2.0
   enddo
!DIR$ END OFFLOAD
...
end subroutine sample

See OFFLOAD for further examples.