PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

PGF90-S-0155-Calls from device code to a host function are a

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
Peter Nightingale



Joined: 14 Oct 2010
Posts: 20

PostPosted: Mon Feb 07, 2011 6:53 am    Post subject: PGF90-S-0155-Calls from device code to a host function are a Reply with quote

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
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6125
Location: The Portland Group Inc.

PostPosted: Mon Feb 07, 2011 6:01 pm    Post subject: Reply with quote

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
View user's profile
jtull



Joined: 30 Jun 2004
Posts: 438

PostPosted: Tue May 14, 2013 3:16 pm    Post subject: TPR 17672 is fixed. Reply with quote

Some late housekeeping. This TPR has been fixed as of the 12.8 release.

thanks,
dave
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
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 © phpBB Group