Intel® Fortran Compiler 17.0 Developer Guide and Reference

qoffload-attribute-target, Qoffload-attribute-target

Causes the compiler to flag procedures and data objects in the source file with the offload attribute target(mic). This option only applies to Intel® MIC Architecture. Option -qoffload-attribute-target is the replacement option for -offload-attribute-target, which is deprecated.

Architecture Restrictions

Only available on Intel® 64 architecture targeting Intel® MIC Architecture

Syntax

Linux:

-qoffload-attribute-target=target-name

macOS:

None

Windows:

/Qoffload-attribute-target:target-name

Arguments

target-name

Is a specific target. The only supported value for this argument is mic.

Default

OFF

The compiler does not flag procedures and data objects in the source file with the offload attribute target(mic).

Description

This option causes the compiler to flag procedures and data objects in the source file with the offload attribute target(mic).

This option is similar to using the required individual directive ATTRIBUTES OFFLOAD:MIC to set the attribute target(mic) for all procedures and data objects in the source file.

Individual directive ATTRIBUTES OFFLOAD:MIC embedded in the source takes precedence over this option.

IDE Equivalent

None

Alternate Options

None

Example

The following example shows the [q or Q]offload-attribute-target option. The module variable t_glob is updated only on the host; the module variable t_priv is updated only on the target. The [q or Q]offload-attribute-target option is used to flag all of the global procedures and global variables with the target(mic) attribute so individual ATTRIBUTES directives do not need to be inserted in the sources for the global procedures and global variables that are available on both the host and the target.


t.F90
=========
program sample
  use m, only : t_glob, glob_func
  integer :: i
  !dir$ offload target(mic) out(i, t_glob)
  i = glob_func()
  write(*, '( "main: t_glob = ",i0," i = ",i0)' ) t_glob, i
end program sample

m.F90
=========
module m
  integer :: t_glob = 65
  public :: glob_func
  integer :: t_priv = 43
  private  :: priv_func, t_priv
contains
  integer function priv_func ()
!   Increment on target only
#   ifdef __MIC__
      t_priv = t_priv + 1
#   endif
      priv_func = t_priv / 2
  end function priv_func
  integer function glob_func ()
      integer :: j
      j = priv_func()
      write(*, '( "glob_func: t_priv = ",i0," j = ",i0)' ) t_priv, j
!   Increment on target only#
    ifdef __MIC__
      t_glob = t_glob + 1
#   endif
      glob_func = t_glob / 2
  end function glob_func
end module m

The command-lines for compiling the source files are:

Linux*:


$ ifort -c m.F90 -qoffload-attribute-target=mic
$ ifort m.o t.F90 -o t.exe

Windows*:


$ ifort /c m.F90 /Qoffload-attribute-target:mic
$ ifort m.obj t.F90 /exe:t.exe

The output of t.exe will look similar to the following:

glob_func: t_priv = 44 j = 22
main: t_glob = 66 i = 33

See Also