Hello,
I use nvfortran compiler in my code for a while. Yet after an update I did yesterday on my computer on the terminal (sudo apt-get update), the codes which are ccompiled with openACC flags gave error. Also when I run nvidia-smi on the terminal it gives the message “NVIDIA-SMI has failed because it couldn’t communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.” (I do not know whether it is relevant.). I could not figure out a way to solve the problem.
A sample code that that had been working until yesterday.
module generator
implicit none
contains
subroutine init_diag_dom_mat(A)
real*8, intent(out), dimension(:,:) :: A
integer :: i,j,nsize
real*8 :: sum, x
nsize = ubound(A,1)
do i = 1, nsize
sum = 0
do j = 1, nsize
call random_number(x)
x = mod(x, 23.0d0) / 1000.0d0
A(j,i) = x
sum = sum + x
end do
A(i,i) = A(i,i) + sum
! in order make it like identity matrix
do j = 1, nsize
A(j,i) = A(j,i) / sum
end do
end do
end subroutine
end module generator
program main
use generator
use omp_lib
implicit none
integer :: nsize, i, j, iters, max_iters, riter
real*8, allocatable :: A(:,:), b(:)
real*8, allocatable, target :: x1(:), x2(:)
real*8, pointer, contiguous :: xnew(:), xold(:), xtmp(:)
real*8 :: r, residual, rsum, dif, err, chksum
real*8, parameter :: TOLERANCE = 0.00000001
real*8 :: start_time, elapsed_time
nsize = 10
max_iters = 1000000000
riter = 10000000
allocate(A(nsize,nsize))
allocate(b(nsize), x1(nsize), x2(nsize))
! configuration of the matrix A
call init_diag_dom_mat(A)
! configuration of the vectors x1, x2, b
x1 = 0
x2 = 0
do i = 1, nsize
call random_number(r)
b(i) = mod(r, 51.0d0) / 100.0d0
end do
start_time = omp_get_wtime()
residual = TOLERANCE + 1.0d0 ! + 1.0d0 is put to meet the while condition at the first step
iters = 0
! swap these in each iteration
xnew => x1
xold => x2
!$acc data copyin(A(:,:), b(:)) copy(x1(:), x2(:))
do while(residual > TOLERANCE .and. iters < max_iters)
iters = iters + 1
! swap of input and output vectors
xtmp => xnew
xnew => xold
xold => xtmp
!$acc parallel loop private(rsum) async
do i = 1, nsize
rsum = 0
!$acc loop reduction(+:rsum)
do j = 1, nsize
if ( i /= j ) rsum = rsum + A(j,i) * xold(j)
end do
xnew(i) = (b(i) - rsum) / A(i,i)
end do
residual = 0
!$acc parallel loop reduction(+:residual) private(dif) async
do i = 1, nsize
dif = xnew(i) - xold(i)
residual = residual + dif * dif
end do
!$acc wait
residual = sqrt(residual)
if( mod(iters, riter) == 0) write (*,*) "Iteration", iters, ", & residual is", residual
end do
!$acc end data
elapsed_time = omp_get_wtime() - start_time
write (*,*) "Converged after ", iters, " iterations"
write (*,*) " and ", elapsed_time, " seconds"
write (*,*) " residual is ", residual
deallocate(A, b, x1, x2)
end program main
This is the Makefile:
FC=nvfortran
TIMER=/usr/bin/time
OPT=
NOPT=-fast -Minfo=opt $(OPT)
jacobi_acc: jacobi_acc.o
$(TIMER) ./jacobi_acc.o $(STEPS)
jacobi_acc.o: jacobi_acc.f90
$(FC) -o $@ $< $(NOPT) -ta:tesla:cc75 -Minfo=accel
clean:
rm -f *.o *.exe *.s *.mod a.out
When I compile and run it, it gives the error:
/usr/bin/time ./jacobi_acc.o
Current file: /home/yunus/Desktop/Parallel/jacobi_acc/jacobi_acc.f90
function: main
line: 84
This file was compiled: -ta=tesla:cc70,cc75
Command exited with non-zero status 1
0.03user 0.03system 0:00.09elapsed 77%CPU (0avgtext+0avgdata 10008maxresident)k
0inputs+0outputs (0major+3330minor)pagefaults 0swaps
make: *** [Makefile:10: jacobi_acc] Error 1
Line 84 is !$acc parallel loop private(rsum) async.
In another code that works fine with nvfortran without OpenACC flags, the errors with OpenACC flags are:
/usr/bin/ld: /home/yunus/Desktop/000QAGE/OBJ/Modules/mod_fem.o: in function mod_fem_copy2device3_': /home/yunus/Desktop/000QAGE/SRC/Modules/mod_fem.f90:29: undefined reference to
__pgi_uacc_dataenterstart2’
/usr/bin/ld: /home/yunus/Desktop/000QAGE/SRC/Modules/mod_fem.f90:29: undefined reference to __pgi_uacc_dataonb' /usr/bin/ld: /home/yunus/Desktop/000QAGE/SRC/Modules/mod_fem.f90:29: undefined reference to
__pgi_uacc_dataenterdone’
/usr/bin/ld: /home/yunus/Desktop/000QAGE/SRC/Modules/mod_fem.f90:30: undefined reference to __pgi_uacc_dataenterstart2' /usr/bin/ld: /home/yunus/Desktop/000QAGE/SRC/Modules/mod_fem.f90:30: undefined reference to
__pgi_uacc_dataonb’
/usr/bin/ld: /home/yunus/Desktop/000QAGE/SRC/Modules/mod_fem.f90:30: undefined reference to __pgi_uacc_dataenterdone' /usr/bin/ld: /home/yunus/Desktop/000QAGE/SRC/Modules/mod_fem.f90:32: undefined reference to
__pgi_uacc_dataenterstart2’
/usr/bin/ld: /home/yunus/Desktop/000QAGE/SRC/Modules/mod_fem.f90:32: undefined reference to __pgi_uacc_dataonb' /usr/bin/ld: /home/yunus/Desktop/000QAGE/SRC/Modules/mod_fem.f90:32: undefined reference to
__pgi_uacc_dataenterdone’
/usr/bin/ld: /home/yunus/Desktop/000QAGE/OBJ/Modules/mod_fem.o: in function mod_fem_copy2host3_': /home/yunus/Desktop/000QAGE/SRC/Modules/mod_fem.f90:41: undefined reference to
__pgi_uacc_dataexitstart2’
/usr/bin/ld: /home/yunus/Desktop/000QAGE/SRC/Modules/mod_fem.f90:41: undefined reference to __pgi_uacc_dataoffb2' /usr/bin/ld: /home/yunus/Desktop/000QAGE/SRC/Modules/mod_fem.f90:41: undefined reference to
__pgi_uacc_dataexitdone’
/usr/bin/ld: /home/yunus/Desktop/000QAGE/SRC/Modules/mod_fem.f90:43: undefined reference to __pgi_uacc_dataexitstart2' /usr/bin/ld: /home/yunus/Desktop/000QAGE/SRC/Modules/mod_fem.f90:43: undefined reference to
__pgi_uacc_dataoffb2’
/usr/bin/ld: /home/yunus/Desktop/000QAGE/SRC/Modules/mod_fem.f90:43: undefined reference to __pgi_uacc_dataexitdone' /usr/bin/ld: /home/yunus/Desktop/000QAGE/SRC/Modules/mod_fem.f90:44: undefined reference to
__pgi_uacc_dataexitstart2’
/usr/bin/ld: /home/yunus/Desktop/000QAGE/SRC/Modules/mod_fem.f90:44: undefined reference to __pgi_uacc_dataoffb2' /usr/bin/ld: /home/yunus/Desktop/000QAGE/SRC/Modules/mod_fem.f90:44: undefined reference to
__pgi_uacc_dataexitdone’
/usr/bin/ld: /home/yunus/Desktop/000QAGE/OBJ/Modules/mod_fem.o: in function mod_fem_copy2device2_': /home/yunus/Desktop/000QAGE/SRC/Modules/mod_fem.f90:51: undefined reference to
__pgi_uacc_dataenterstart2’
/usr/bin/ld: /home/yunus/Desktop/000QAGE/SRC/Modules/mod_fem.f90:51: undefined reference to __pgi_uacc_dataonb' /usr/bin/ld: /home/yunus/Desktop/000QAGE/SRC/Modules/mod_fem.f90:51: undefined reference to
__pgi_uacc_dataenterdone’
/usr/bin/ld: /home/yunus/Desktop/000QAGE/SRC/Modules/mod_fem.f90:52: undefined reference to __pgi_uacc_dataenterstart2' /usr/bin/ld: /home/yunus/Desktop/000QAGE/SRC/Modules/mod_fem.f90:52: undefined reference to
_pgi_uacc_dataonb’
/usr/bin/ld: /home/yunus/Desktop/000QAGE/SRC/Modules/mod_fem.f90:52: undefined reference to __pgi_uacc_dataenterdone' /usr/bin/ld: /home/yunus/Desktop/000QAGE/OBJ/Modules/mod_fem.o: in function
mod_fem_copy2host2’:
/home/yunus/Desktop/000QAGE/SRC/Modules/mod_fem.f90:59: undefined reference to __pgi_uacc_dataexitstart2' /usr/bin/ld: /home/yunus/Desktop/000QAGE/SRC/Modules/mod_fem.f90:59: undefined reference to
__pgi_uacc_dataoffb2’
/usr/bin/ld: /home/yunus/Desktop/000QAGE/SRC/Modules/mod_fem.f90:59: undefined reference to __pgi_uacc_dataexitdone' /usr/bin/ld: /home/yunus/Desktop/000QAGE/SRC/Modules/mod_fem.f90:60: undefined reference to
__pgi_uacc_dataexitstart2’
/usr/bin/ld: /home/yunus/Desktop/000QAGE/SRC/Modules/mod_fem.f90:60: undefined reference to __pgi_uacc_dataoffb2' /usr/bin/ld: /home/yunus/Desktop/000QAGE/SRC/Modules/mod_fem.f90:60: undefined reference to
__pgi_uacc_dataexitdone’
make[1]: *** [Makefile:28: all] Error 2
Also pgaccelinfo | less says No accelerators found.
Thanks,
Y