|
| View previous topic :: View next topic |
| Author |
Message |
Peter Nightingale
Joined: 14 Oct 2010 Posts: 20
|
Posted: Mon Feb 07, 2011 6:53 am Post subject: PGF90-S-0155-Calls from device code to a host function are a |
|
|
The following program compiles successfully:
module mod
contains
attributes(global) subroutine one(a,nthread,nblock)
implicit none
integer, value :: nthread,nblock
integer, device :: a(nthread,nblock)
! integer :: two
a(threadidx%x,blockidx%x)=two(a(threadidx%x,blockidx%x))
a(threadidx%x,blockidx%x)=two(a(threadidx%x,blockidx%x))
end subroutine one
attributes(device) integer function two(a)
implicit none
integer :: a
two=a+threadidx%x+10*blockidx%x
end function two
end module mod
program main
use mod
integer, device, allocatable :: d_a(:,:),d_nthread,d_nblock
integer, allocatable :: a(:,:)
nthread=2
nblock=2
allocate(d_a(nthread,nblock))
allocate(a(nthread,nblock))
d_a=0
call one<<<nthread,nblock>>>(d_a,nthread,nblock)
istat=cudathreadsynchronize()
a=d_a
write(*,*) a
end program main
However, if I uncomment the line
! integer :: two
in subroutine one, I get the following compiler messages:
PGF90-S-0155-Calls from device code to a host function are allowed only in emulation mode - two (tst.cuf: 8)
PGF90-S-0155-Calls from device code to a host function are allowed only in emulation mode - two (tst.cuf: 9)
What the compiler is trying to tell me?
Peter Nightingale |
|
| Back to top |
|
 |
mkcolg
Joined: 30 Jun 2004 Posts: 4995 Location: The Portland Group Inc.
|
Posted: Mon Feb 07, 2011 6:01 pm Post subject: |
|
|
Hi Peter Nightingale,
When you declare "integer :: two", you're actually declaring an external function. So when the compiler reaches the use of "two" it issues the syntax error since at this point, it doesn't know that you really mean for the external "two" to be the same as the module's "two" routine.
I have submitted a technical problem report (TPR#17672) to see if we can delay this check until after the entire module is processed and all internal reference have be resolved.
Thanks,
Mat |
|
| Back to top |
|
 |
jtull
Joined: 30 Jun 2004 Posts: 233
|
Posted: Tue May 14, 2013 3:16 pm Post subject: TPR 17672 is fixed. |
|
|
Some late housekeeping. This TPR has been fixed as of the 12.8 release.
thanks,
dave |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2002 phpBB Group
|