public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mehdi.chinoune at hotmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libgomp/98258] Can't compile programs for both OpenMP (CPU) + OpenACC (GPU)
Date: Mon, 04 Jan 2021 16:43:24 +0000	[thread overview]
Message-ID: <bug-98258-4-WcN6ItDbqm@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-98258-4@http.gcc.gnu.org/bugzilla/>

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

  parent reply	other threads:[~2021-01-04 16:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-13  4:52 [Bug libgomp/98258] New: " mehdi.chinoune at hotmail dot com
2021-01-04 14:26 ` [Bug libgomp/98258] " rguenth at gcc dot gnu.org
2021-01-04 16:43 ` mehdi.chinoune at hotmail dot com [this message]
2021-01-04 16:52 ` jakub at gcc dot gnu.org
2021-01-04 17:34 ` mehdi.chinoune at hotmail dot com
2021-01-04 21:42 ` amonakov at gcc dot gnu.org
2021-01-05  4:34 ` mehdi.chinoune at hotmail dot com
2021-01-05  6:16 ` mehdi.chinoune at hotmail dot com
2021-01-05  7:43 ` amonakov at gcc dot gnu.org
2021-01-05  8:15 ` mehdi.chinoune at hotmail dot com
2021-01-05  8:48 ` amonakov at gcc dot gnu.org
2021-01-05 13:12 ` mehdi.chinoune at hotmail dot com
2021-07-28  8:27 ` mehdi.chinoune at hotmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-98258-4-WcN6ItDbqm@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).