Skip to content

ACC001 implicit-data-movement ​

warning enabled by default

The compiler moves data implicitly for an OpenACC compute region (nvfortran: 'Generating implicit copy').

Why ​

When a compute region uses an array that no enclosing data region or present clause covers, the compiler inserts a copy for that launch. [if not already present] means the copy is skipped only if the data happens to be on the device: in a loop of kernel launches this silently becomes a host-device transfer per launch, usually the dominant cost. Keep the data resident (!$acc enter data, a data region around the loop, declare create) and state it with present(...) or default(present), which also turns a missing device copy into a runtime error instead of a slow transfer. Reported only with fobis lint --compiler-feedback LOG (see the linting guide).

Reported ​

fortran
!$acc parallel loop          ! nvfortran: Generating implicit copy(y(:n))
do i = 1, n
  y(i) = y(i) + a * x(i)
end do

Preferred ​

fortran
!$acc enter data copyin(x, y)        ! once, outside the time loop
...
!$acc parallel loop present(x, y)
do i = 1, n
  y(i) = y(i) + a * x(i)
end do

Suppressing ​

For one occurrence, with the reason on the same line (or alone on the line before the statement):

fortran
! fobis: ignore[ACC001] <why this occurrence is fine>

For the whole project, ignore = ACC001 in the fobos [lint] section.