Skip to content

ACC007 device-routine-assumed-shape-lower-bound ​

warning opt-in

A device routine has an assumed-shape dummy with a non-default lower bound (q(0:), q(1-ng:)).

Why ​

In device code, assumed-shape dummies with explicit lower bounds go through array descriptors that nvfortran handles unreliably (wrong offsets, failing launches). Pass the bounds as integer arguments and declare the dummy with explicit shape (q(lo:hi)), indexing with them.

Reported ​

fortran
subroutine stencil(q, i)
  !$acc routine seq
  real, intent(in) :: q(1-ng:)

Preferred ​

fortran
subroutine stencil(q, lo, hi, i)
  !$acc routine seq
  integer, intent(in) :: lo, hi, i
  real, intent(in) :: q(lo:hi)

Suppressing ​

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

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

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

References ​

Sections of the shipped knowledge packs behind this rule:

  • hpc-practice:gpu-practice#device-code-pitfalls (fobis kb show hpc-practice:gpu-practice#device-code-pitfalls)