Error - undefined reference to __pgi_uacc_

Hi,
I am using OpenACC to accelerate my Fortran code.
I am getting errors (undefined reference to …) shown in following code,. These errors show up while linking.

I am using acc directive in a subroutine and I have show part of this code below.
Many thanks for any advice.

Thanks,
Guanfeng

pgfortran -acc -Minfo=acc   -c ./peri_motion.f90
peri_motion_velocity_verlet_cuda:
     39, Generating present_or_copyin(pos1(:))
         Generating present_or_copyin(pos2(:))
         Generating present_or_copyin(pos3(:))
         Generating present_or_copy(damage_index(:))
         Generating present_or_copy(strain_energy(:))
         Generating create(all_force1(:))
         Generating create(all_force2(:))
         Generating create(all_force3(:))
         Generating create(phi1)
         Generating create(phi)
         Generating create(phi2)
         Generating create(n_broken_bounds)
     52, Accelerator scalar kernel generated
         Generating present_or_copy(bond_strain_energy(:))
         Generating present_or_copy(broke(:,:))
         Generating Tesla code
     54, Parallelization requires privatization of 'all_force1' as well as last value
         Accelerator scalar kernel generated
     55, Parallelization requires privatization of 'all_force2' as well as last value
         Accelerator scalar kernel generated
     56, Parallelization requires privatization of 'all_force3' as well as last value
         Accelerator scalar kernel generated
     58, Accelerator scalar kernel generated
     62, Accelerator restriction: induction variable live-out from loop: mi
     68, Scalar last value needed after loop for 'str' at line 360
         Loop carried scalar dependence for 'df1' at line 190
         Scalar last value needed after loop for 'df1' at line 370
         Loop carried scalar dependence for 'df2' at line 191
         Scalar last value needed after loop for 'df2' at line 371
         Loop carried scalar dependence for 'df3' at line 192
         Scalar last value needed after loop for 'df3' at line 372
         Scalar last value needed after loop for 'dw' at line 373
         Accelerator restriction: scalar variable live-out from loop: brokij
         Accelerator scalar kernel generated
    197, Loop is parallelizable
         Accelerator kernel generated
        197, !$acc loop gang, vector(128) ! blockidx%x threadidx%x
    200, Loop is parallelizable
    202, Loop is parallelizable
    203, Loop is parallelizable
    204, Loop is parallelizable
    211, Accelerator scalar kernel generated
    226, Accelerator restriction: induction variable live-out from loop: mi
    234, Loop carried scalar dependence for 'str' at line 360
         Loop carried scalar dependence for 'df1' at line 370
         Loop carried scalar dependence for 'df2' at line 371
         Loop carried scalar dependence for 'df3' at line 372
         Loop carried scalar dependence for 'dw' at line 373
         Loop carried dependence due to exposed use of 'broke(:,:)' prevents parallelization
         Accelerator restriction: scalar variable live-out from loop: brokij
         Accelerator scalar kernel generated
    378, Loop is parallelizable
         Accelerator kernel generated
        378, !$acc loop gang, vector(128) ! blockidx%x threadidx%x
    381, Loop is parallelizable
    384, Loop is parallelizable
    385, Loop is parallelizable
    386, Loop is parallelizable
    387, Loop is parallelizable
    393, Loop is parallelizable
    401, Loop is parallelizable
         Accelerator kernel generated
        401, !$acc loop gang, vector(128) ! blockidx%x threadidx%x
pgfortran -acc -Minfo=acc   -c ./dynamics.f90
pgfortran -acc -Minfo=acc   -c ./Solver.f90
pgfortran -acc -Minfo=acc   -c ./EMUNE3D.f90
pgfortran -o EMUNE3D Objects.o Global_variables.o module_precision.o Input_subroutines.o Horizon.o Get_family.o damage.o peri_motion.o dynamics.o Solver.o EMUNE3D.o
peri_motion.o: In function `peridynamic_computations_peri_motion_velocity_verlet_cuda_':
/home/guanfeng/CUDA/EMUNE3D_polyC_v2/./peri_motion.f90:39: undefined reference to `__pgi_uacc_dataenterstart'
/home/guanfeng/CUDA/EMUNE3D_polyC_v2/./peri_motion.f90:411: undefined reference to `__pgi_uacc_dataonb'
/home/guanfeng/CUDA/EMUNE3D_polyC_v2/./peri_motion.f90:411: undefined reference to `__pgi_uacc_dataonb'
/home/guanfeng/CUDA/EMUNE3D_polyC_v2/./peri_motion.f90:411: undefined reference to `__pgi_uacc_dataonb'
/home/guanfeng/CUDA/EMUNE3D_polyC_v2/./peri_motion.f90:411: undefined reference to `__pgi_uacc_dataonb'
/home/guanfeng/CUDA/EMUNE3D_polyC_v2/./peri_motion.f90:411: undefined reference to `__pgi_uacc_dataonb'
peri_motion.o:/home/guanfeng/CUDA/EMUNE3D_polyC_v2/./peri_motion.f90:411: more undefined references to `__pgi_uacc_dataonb' follow



subroutine velocity_verlet_cuda
!$acc data &
!$acc present_or_copyin( pos1, pos2, pos3,	&
!$acc  		  f1, f2, f3, 	 			&
!$acc  		  ext1, ext2, ext3,	  		&
!$acc         A1, A2,critical_strain)   &
!$acc present_or_copy( disp1, disp2, disp3,      &
!$acc  		veloc1, veloc2, veloc3,   &
!$acc       damage_index, strain_energy),  &
!$acc create(all_force1,all_force2,all_force3, phi1,  Phi,  phi2, n_broken_bounds)

!$acc kernels
n_broken_bounds = 0
  all_force1(:) = ZERO
  all_force2(:) = ZERO
  all_force3(:) = ZERO
!$acc do private(mi)
    do mi=1,nnodes
        new_veloc1(mi) = veloc1(mi)
        new_veloc2(mi) = veloc2(mi)
        new_veloc3(mi) = veloc3(mi)             
    enddo  

............................

!$acc end kernels
!$acc end data     

end subroutine velocity_verlet_cuda

Hi Guanfeng,

You just need to add “-acc” to your link flags. Otherwise the OpenACC runtime isn’t linked in.

  • Mat

Hi Mat,

Now it is working.
BTW, where can I got an manual of debug OpenACC code?

Thanks,
Guanfeng

What are you looking for? General strategies? How to debug OpenACC using a debugger?

For the debugger, Allinea is the place to go: Arm Forge | Cross Platform Parallel Debugger for C++ and Cuda – Arm®

For general strategies, you’ll typically find those in OpenACC articles and webinars as part of the overall tutorial. Though, I don’t know of any articles or manuals that are specific to debugging.

The PGI User Forum is a great place to find answers, but they are typically answers to specific errors rather that general strategies.

  • Mat