PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

Problems with linking

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming
View previous topic :: View next topic  
Author Message
Tez



Joined: 07 Apr 2011
Posts: 2

PostPosted: Mon Apr 11, 2011 10:35 am    Post subject: Problems with linking Reply with quote

Hello,
I am trying to complile a simple CUDA code with pgfortran.
Code:

attributes(global) subroutine S
end subroutine S

program P
call S<<1, 1>>
end program P

As a result, I have this:
Code:

# pgfortran test.cuf
In function 'p`: /..././test.cuf: undefined reference to 's_`

I am using PGI workstation 10.3
CentOS 5.2
Code:

# pgaccelinfo
CUDA Driver Version 3020
Device name: Tesla C2050

pgfortran -c test.cuf compiled without any errors
Is there incompatibility between libraries? I have no idea.
Back to top
View user's profile
mkcolg



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

PostPosted: Mon Apr 11, 2011 12:05 pm    Post subject: Reply with quote

Hi Tez,

CUDA Fortran device kernels require interfaces in order to be called from host code. Hence, you either write an explicit interface for S in your main program or put S in a module where an implicit interface is generated.

Code:
module foo
contains
attributes(global) subroutine S
end subroutine S
end module foo

program P
use foo
call S<<<1, 1>>>()
end program P


Hope this helps,
Mat
Back to top
View user's profile
Tez



Joined: 07 Apr 2011
Posts: 2

PostPosted: Tue Apr 12, 2011 9:39 am    Post subject: Reply with quote

Yes, it helped, thanks.
Until then, I only programmed in CUDA C and didn't know about this feature in fortran.
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming 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