https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98258

--- Comment #2 from Chinoune <mehdi.chinoune at hotmail dot com> ---
program main
  use omp_lib
  implicit none
  integer, parameter :: sp = selected_real_kind(6,37)
  integer :: i, j, k
  integer :: n
  character(len=5) :: var
  real(sp), allocatable :: a(:,:), b(:,:), c(:,:), cc(:,:)
  integer :: t1, t2, t3
  real(sp) :: tic
  !
  call get_command_argument( 1, var )
  read( var, '(i5.3)') n
  print*, "dim1 = dim2 = ", n
  !
  allocate( a(n,n), b(n,n), c(n,n), cc(n,n) )
  call random_number(a)
  call random_number(b)
  cc = 0._sp
  c = 0._sp
  !
  call system_clock(t1, tic)
  !$omp parallel do collapse(3)
  do j = 1, n
    do k = 1, n
          do i = 1, n
            cc(i,j) = a(i,k)*b(k,j) + cc(i,j)
      end do
        end do
  end do
  !
  call system_clock( t2 )
  print*, "CPU Time = ", (t2-t1)/tic
  !$acc data copyin(a,b) copy(c)
  !$acc parallel loop collapse(3)
  do j = 1, n
    do k = 1, n
          do i = 1, n
            c(i,j) = a(i,k)*b(k,j) + c(i,j)
      end do
        end do
  end do
  !$acc end data
  call system_clock(t3)
  print*, "GPU Time = ", (t3-t2)/tic
  print*, "Max(|C2-C1|) = ", maxval( abs(cc-c) )
  !
end program main

gfortran -fopenmp -fopenacc bug_omp_acc.f90 -o test.x

mkoffload: fatal error: either '-fopenacc' or '-fopenmp' must be set
compilation terminated.
lto-wrapper: fatal error:
/usr/lib/gcc/x86_64-linux-gnu/9//accel/nvptx-none/mkoffload returned 1 exit
status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status

Reply via email to