I’m trying to compile the following OpenMP Fortran program using the -mp compiler option.
program omp
use omp_lib
implicit none
integer:: k,sz=1000
integer::c1,c2
integer,dimension(:),allocatable,save :: tr
integer:: on
!$omp threadprivate(tr,on)
call system_clock( count=c1 )
!$omp parallel num_threads(4) private(k) shared(sz) default(none)
call allo() !allocate mutiple instances of tr
on=0
!$omp DO
do k=1,sz
call finder(k)
end do
!$omp end do
!$omp end parallel
call system_clock( count=c2 )
!write(*,“(8ES14.7E2)”),z
print *,“----------------------”
print *,“time:”, (c2-c1)/10
contains
subroutine finder(k)
integer, intent(in)::k
tr(on)=k
on=on+1
!xt=xt+tr
!print *, tr
end subroutine finder
subroutine allo()
allocate(tr(1000))
tr=0
end subroutine allo
end program omp
However, I get the following error:
!:GPU-Test: pgf90 -mp testprivate.f90
/tmp/pgf90AMHboze-RgCn.o: In function finder': /home/hainesc/workspace/omp/src/./testprivate.f90:38: undefined reference to TPptr_p_’
/tmp/pgf90AMHboze-RgCn.o: In function allo': /home/hainesc/workspace/omp/src/./testprivate.f90:45: undefined reference to TPptr_p_’
/home/hainesc/workspace/omp/src/./testprivate.f90:45: undefined reference to TPptr_p_' /home/hainesc/workspace/omp/src/./testprivate.f90:46: undefined reference to TPptr_p_’
If I make a separate module out of the subroutines, this logic works. Is this a possible compiler error?
Thanks.