public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgomp/98258] New: Can't compile programs for both OpenMP (CPU) + OpenACC (GPU)
@ 2020-12-13  4:52 mehdi.chinoune at hotmail dot com
  2021-01-04 14:26 ` [Bug libgomp/98258] " rguenth at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: mehdi.chinoune at hotmail dot com @ 2020-12-13  4:52 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98258
           Summary: Can't compile programs for both OpenMP (CPU) + OpenACC
                    (GPU)
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgomp
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mehdi.chinoune at hotmail dot com
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

Trying to use OpenMP (CPU) for some parts and OpenACC (GPU) for others.
I got:
mkoffload: fatal error: either '-fopenacc' or '-fopenmp' must be set

Another use is for multi-GPU programming, where OpenMP is used to distribute
work among different GPUs

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libgomp/98258] Can't compile programs for both OpenMP (CPU) + OpenACC (GPU)
  2020-12-13  4:52 [Bug libgomp/98258] New: Can't compile programs for both OpenMP (CPU) + OpenACC (GPU) mehdi.chinoune at hotmail dot com
@ 2021-01-04 14:26 ` rguenth at gcc dot gnu.org
  2021-01-04 16:43 ` mehdi.chinoune at hotmail dot com
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-01-04 14:26 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |openacc, openmp

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Can you provide a testcase?  I assume there's TUs with openacc and TUs with
openmp and the error happens at link-time?

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libgomp/98258] Can't compile programs for both OpenMP (CPU) + OpenACC (GPU)
  2020-12-13  4:52 [Bug libgomp/98258] New: Can't compile programs for both OpenMP (CPU) + OpenACC (GPU) 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
  2021-01-04 16:52 ` jakub at gcc dot gnu.org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mehdi.chinoune at hotmail dot com @ 2021-01-04 16:43 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libgomp/98258] Can't compile programs for both OpenMP (CPU) + OpenACC (GPU)
  2020-12-13  4:52 [Bug libgomp/98258] New: Can't compile programs for both OpenMP (CPU) + OpenACC (GPU) 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
@ 2021-01-04 16:52 ` jakub at gcc dot gnu.org
  2021-01-04 17:34 ` mehdi.chinoune at hotmail dot com
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-01-04 16:52 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amonakov at gcc dot gnu.org,
                   |                            |burnus at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The error comes from config/nvptx/mkoffload.c
  if (!(fopenacc ^ fopenmp))
    fatal_error (input_location, "either %<-fopenacc%> or %<-fopenmp%> "
                 "must be set");
I guess this is because in order to compile NVPTX offloading OpenMP code one
needs different Options (e.g. -mgomp ) than for OpenACC code, making NVPTX
offloading incompatible between the two standards.
I think you can use both if you disable nvptx offloading (e.g. through
-foffload= option).

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libgomp/98258] Can't compile programs for both OpenMP (CPU) + OpenACC (GPU)
  2020-12-13  4:52 [Bug libgomp/98258] New: Can't compile programs for both OpenMP (CPU) + OpenACC (GPU) mehdi.chinoune at hotmail dot com
                   ` (2 preceding siblings ...)
  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
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mehdi.chinoune at hotmail dot com @ 2021-01-04 17:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Chinoune <mehdi.chinoune at hotmail dot com> ---
gfortran -O3 -fopenmp -fopenacc -foffload=disable bug_omp_acc.f90 -o test.x
./test.x 2048
 dim1 = dim2 =         2048
 CPU Time =    4.99999989E-03

libgomp: target function wasn't mapped

gfortran -O3 -fopenacc -foffload=disable bug_omp_acc.f90 -o test.x
./test.x 2048
 dim1 = dim2 =         2048
 CPU Time =    1.90100002    

libgomp: target function wasn't mapped

gfortran -O3 -fopenmp -foffload=disable bug_omp_acc.f90 -o test.x
./test.x 2048
 dim1 = dim2 =         2048
 CPU Time =    6.00000005E-03
 GPU Time =    1.44500005    
 Max(|C2-C1|) =    559.285156

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libgomp/98258] Can't compile programs for both OpenMP (CPU) + OpenACC (GPU)
  2020-12-13  4:52 [Bug libgomp/98258] New: Can't compile programs for both OpenMP (CPU) + OpenACC (GPU) mehdi.chinoune at hotmail dot com
                   ` (3 preceding siblings ...)
  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
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: amonakov at gcc dot gnu.org @ 2021-01-04 21:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
One possible solution is -foffload=-fno-openmp

Another possible solution is separate compilation and linking, with only
OpenACC enabled at link step (needs explicit -lgomp):

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libgomp/98258] Can't compile programs for both OpenMP (CPU) + OpenACC (GPU)
  2020-12-13  4:52 [Bug libgomp/98258] New: Can't compile programs for both OpenMP (CPU) + OpenACC (GPU) mehdi.chinoune at hotmail dot com
                   ` (4 preceding siblings ...)
  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
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mehdi.chinoune at hotmail dot com @ 2021-01-05  4:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Chinoune <mehdi.chinoune at hotmail dot com> ---
There is no mention of "-foffload=-fno-openmp" on documentation
https://gcc.gnu.org/wiki/Offloading#Compilation_options

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libgomp/98258] Can't compile programs for both OpenMP (CPU) + OpenACC (GPU)
  2020-12-13  4:52 [Bug libgomp/98258] New: Can't compile programs for both OpenMP (CPU) + OpenACC (GPU) mehdi.chinoune at hotmail dot com
                   ` (5 preceding siblings ...)
  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
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mehdi.chinoune at hotmail dot com @ 2021-01-05  6:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Chinoune <mehdi.chinoune at hotmail dot com> ---
$ gfortran -O3 -fopenmp -fopenacc -foffload=-fno-openmp  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

$ gfortran-10 -O3 -fopenmp -fopenacc -foffload=-fno-openmp  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/10//accel/nvptx-none/mkoffload returned 1 exit
status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status

$ gfortran-10 -O3 -fopenmp -fopenacc -c bug_omp_acc.f90
$ gfortran-10 bug_omp_acc.o -lgomp -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/10//accel/nvptx-none/mkoffload returned 1 exit
status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status

Please, stop suggesting untested workarounds.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libgomp/98258] Can't compile programs for both OpenMP (CPU) + OpenACC (GPU)
  2020-12-13  4:52 [Bug libgomp/98258] New: Can't compile programs for both OpenMP (CPU) + OpenACC (GPU) mehdi.chinoune at hotmail dot com
                   ` (6 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: amonakov at gcc dot gnu.org @ 2021-01-05  7:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
(In reply to Chinoune from comment #7)
> $ gfortran-10 -O3 -fopenmp -fopenacc -c bug_omp_acc.f90
> $ gfortran-10 bug_omp_acc.o -lgomp -o test.x

Contrary to my  suggestion, you have omitted -fopenacc from the second command
line, why?

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libgomp/98258] Can't compile programs for both OpenMP (CPU) + OpenACC (GPU)
  2020-12-13  4:52 [Bug libgomp/98258] New: Can't compile programs for both OpenMP (CPU) + OpenACC (GPU) mehdi.chinoune at hotmail dot com
                   ` (7 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mehdi.chinoune at hotmail dot com @ 2021-01-05  8:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Chinoune <mehdi.chinoune at hotmail dot com> ---
I forget it
Anyways

$ gfortran-10 -fopenacc bug_omp_acc.o -lgomp -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/10//accel/nvptx-none/mkoffload returned 1 exit
status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libgomp/98258] Can't compile programs for both OpenMP (CPU) + OpenACC (GPU)
  2020-12-13  4:52 [Bug libgomp/98258] New: Can't compile programs for both OpenMP (CPU) + OpenACC (GPU) mehdi.chinoune at hotmail dot com
                   ` (8 preceding siblings ...)
  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
  11 siblings, 0 replies; 13+ messages in thread
From: amonakov at gcc dot gnu.org @ 2021-01-05  8:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
Thanks for checking. As for this:

> Please, stop suggesting untested workarounds.

Yes, I should have mentioned those are untested. I was typing the response late
at night without access to offloading-capable GCC, just from memory and
understanding how it works. The suggestions didn't require any extraordinary
actions from you. The quoted part was rude. Please be more considerate of
maintainers' time.


I think one of the suggested workarounds should be fixed to work, probably the
-foffload=-fno-openmp one.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libgomp/98258] Can't compile programs for both OpenMP (CPU) + OpenACC (GPU)
  2020-12-13  4:52 [Bug libgomp/98258] New: Can't compile programs for both OpenMP (CPU) + OpenACC (GPU) mehdi.chinoune at hotmail dot com
                   ` (9 preceding siblings ...)
  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
  11 siblings, 0 replies; 13+ messages in thread
From: mehdi.chinoune at hotmail dot com @ 2021-01-05 13:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Chinoune <mehdi.chinoune at hotmail dot com> ---
This is just a normal bug, no need to hurry. you could wait until the other day
and investigate the problem.
I am dual-booting Windows with Ubuntu, so to test your suggestions I have to
reboot to Ubuntu to test them.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libgomp/98258] Can't compile programs for both OpenMP (CPU) + OpenACC (GPU)
  2020-12-13  4:52 [Bug libgomp/98258] New: Can't compile programs for both OpenMP (CPU) + OpenACC (GPU) mehdi.chinoune at hotmail dot com
                   ` (10 preceding siblings ...)
  2021-01-05 13:12 ` mehdi.chinoune at hotmail dot com
@ 2021-07-28  8:27 ` mehdi.chinoune at hotmail dot com
  11 siblings, 0 replies; 13+ messages in thread
From: mehdi.chinoune at hotmail dot com @ 2021-07-28  8:27 UTC (permalink / raw)
  To: gcc-bugs

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

Chinoune <mehdi.chinoune at hotmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WONTFIX
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #12 from Chinoune <mehdi.chinoune at hotmail dot com> ---
No one has the intention to fix it.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-07-28  8:27 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-13  4:52 [Bug libgomp/98258] New: Can't compile programs for both OpenMP (CPU) + OpenACC (GPU) 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
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

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).