ACC011 acc-collapse-imperfect-nest
error enabled by defaultcollapse(n) on OpenACC loops that are not tightly nested.
Why
collapse(n) merges the iteration spaces of n nested loops into one. The specification requires the loops to be tightly nested: no statement between the loop headers or between the end dos. Compilers reject some violations and mishandle others (the extra statements executed once per collapsed iteration, or not at all). Move the statements inside the innermost loop, or collapse fewer levels.
Reported
fortran
!$acc parallel loop collapse(2)
do j = 1, m
c = coef(j) ! between the loop headers
do i = 1, n
a(i, j) = c * b(i, j)
end do
end doPreferred
fortran
!$acc parallel loop collapse(2)
do j = 1, m
do i = 1, n
a(i, j) = coef(j) * b(i, j)
end do
end doSuppressing
For one occurrence, with the reason on the same line (or alone on the line before the statement):
fortran
! fobis: ignore[ACC011] <why this occurrence is fine>For the whole project, ignore = ACC011 in the fobos [lint] section.
References
Sections of the shipped knowledge packs behind this rule:
openacc:patterns#collapse-reduction-for-dense-nests(fobis kb show openacc:patterns#collapse-reduction-for-dense-nests)