PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

unresolved external symbol acc_init_ referenced

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



Joined: 16 Dec 2009
Posts: 31

PostPosted: Tue Mar 02, 2010 8:15 pm    Post subject: unresolved external symbol acc_init_ referenced Reply with quote

I build the code:

program main
use accel_lib
integer :: n ! size of the vector
real,dimension(:),allocatable :: a ! the vector
real,dimension(:),allocatable :: r ! the results
real,dimension(:),allocatable :: e ! expected results
integer :: i
integer :: c0, c1, c2, c3, cgpu, chost
character(10) :: arg1
if( iargc() .gt. 0 )then
call getarg( 1, arg1 )
read(arg1,'(i10)') n
else
n = 100000
endif
if( n .le. 0 ) n = 100000
allocate(a(n))
allocate(r(n))
allocate(e(n))
do i = 1,n
a(i) = i*2.0
enddo
call acc_init( acc_device_nvidia )
call system_clock( count=c1 )
!$acc region
do i = 1,n
r(i) = sin(a(i)) ** 2 + cos(a(i)) ** 2
enddo
!$acc end region
call system_clock( count=c2 )
cgpu = c2 - c1
do i = 1,n
e(i) = sin(a(i)) ** 2 + cos(a(i)) ** 2
enddo
call system_clock( count=c3 )
chost = c3 - c2
! check the results
do i = 1,n
if( abs(r(i) - e(i)) .gt. 0.000001 )then
print *, i, r(i), e(i)
endif
enddo
print *, n, ' iterations completed'
print *, cgpu, ' microseconds on GPU'
print *, chost, ' microseconds on host'
end program

Then:
Linking...
ConsoleApp.obj : error LNK2019: unresolved external symbol acc_init_ referenced in function MAIN_

Why? I need your help Mat,thank you!
Back to top
View user's profile
TheMatt



Joined: 06 Jul 2009
Posts: 317
Location: Greenbelt, MD

PostPosted: Wed Mar 03, 2010 7:52 am    Post subject: Reply with quote

I'm not Mat, but I'm one 't' away. From the look of the error I'm guessing a couple of things. First, you haven't enabled the "-ta" option to actually target an accelerator. This means it doesn't know what accel_lib is so it doesn't know about acc_init. The error you're seeing looks close to what you see on Linux if you forget that.

I'm also guessing you're on PVF. I don't use this myself, but looking at the User's Guide and working off of a response Mat gave a few threads ago, try:

Right-mouse click on your project (under the 'Solution Explorer' window) and select 'Properties'. This opens the properties window. Next select the 'Fortran->Target Accelerators' tab, find the line for 'Target NVIDIA Accelerator' and select 'yes' in the drop-down box.

This should be equivalent to include -ta=nvidia on the command line. With that, the program should work.
Back to top
View user's profile
mkcolg



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

PostPosted: Wed Mar 03, 2010 12:55 pm    Post subject: Reply with quote

Yes, this is the problem. To use the accelerator features, you need have the compile flag "-ta" enabled.

- Mat
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