Issue calling an attributes(device) routine

I have created a device routine to be run from within a separate cuda kernel.
They are both located in the very same file, but when I attempt to compile I get the following errors:

PGF90-S-0155-Illegal call from device code to intvar_d (cudacompute.f: 571)
PGF90-S-0155-Illegal call from device code to intvar_d (cudacompute.f: 575)
PGF90-S-0155-Illegal call from device code to intvar_d (cudacompute.f: 579)
PGF90-S-0155-Illegal call from device code to intvar_d (cudacompute.f: 583)
PGF90-S-0155-Illegal call from device code to intvar_d (cudacompute.f: 587)
PGF90-S-0155-Illegal call from device code to intvar_d (cudacompute.f: 592)
PGF90-S-0155-Illegal call from device code to intvar_d (cudacompute.f: 597)
PGF90-S-0038-Symbol, iflattenflatten, has not been explicitly declared (cudacompute.f)
PGF90-S-0038-Symbol, iflatteflatten, has not been explicitly declared (cudacompute.f)
0 inform, 0 warnings, 9 severes, 0 fatal for inteuler_d
PGF90-S-0155-DEVICE routines can not appear outside a module intvar_d (cudacompute.f: 1702)
PGF90-S-0038-Symbol, intvar_d, has not been explicitly declared (cudacompute.f)
0 inform, 0 warnings, 2 severes, 0 fatal for intvar_d

What am I doing wrong in defining or calling my device kernel to cause this?

A sample call:

      
      call intvar_d(dslice(1,j), idim, i1, i2, isteep, steepen, iflatten,
     &            flatten, c1, c2, c3, c4, c5, c6, char1, char2, c0,
     &            tmp1, tmp2, tmp3, tmp4, dla, dra, dl0, dr0, i)

The definition header:

      attributes(device) function intvar_d(qslice, idim, i1, i2, isteep, steepen, iflatten,
     &                  flatten, c1, c2, c3, c4, c5, c6, char1, char2,
     &                  c0, dq, ql, qr, q6, qla, qra, ql0, qr0, cudaI)

Thanks!

Hi Chris,

They are both located in the very same file

Are they in the same module as well? Device routines must be in the same module as the global and other device routines that call them.

This seems the likely cause, but if not, please post a small reproducing example.

Thanks,
Mat

Thanks, there was in fact a mistake with the module.

Sorry to take so long to reply, it took a while to get to testing it.


Thanks!