Nested accelerated subroutines


I have the Fortran subroutines

subroutine sub_1()
    !$acc routine seq
    call sub_2()
end subroutine sub_1

subroutine sub_2()
    !$acc routine seq
end subroutine sub_2

but unfortunately I get the following compilation error

PGF90-S-0155-Procedures called in a compute region must have acc routine information: sub_2

It seems that I cannot call accelerated subroutines in sequence. Is this correct or I am missing something?

Many thanks!

OK, it seems I solved the problem by adding !$acc routine(sub_2) seq after !$acc routine seq in sub_1 subroutine

Correct. When routines don’t have an interface, the compiler wont know that “sub_2” has a device routine. Hence, you need to specify this with a named acc routine. Alternately, you can add an interface or put these routines in a module so an implicit interface is added.