public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/109699] New: With OpenACC reallocating a fortran pointer on a user type with allocatable fails.
@ 2023-05-02 15:28 patrick.begou@univ-grenoble-alpes.fr
  2023-07-17 12:48 ` [Bug fortran/109699] " patrick.begou@univ-grenoble-alpes.fr
  0 siblings, 1 reply; 2+ messages in thread
From: patrick.begou@univ-grenoble-alpes.fr @ 2023-05-02 15:28 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109699
           Summary: With OpenACC reallocating a fortran pointer on a user
                    type with allocatable fails.
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: patrick.begou@univ-grenoble-alpes.fr
  Target Milestone: ---

Created attachment 54970
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54970&action=edit
Test case to show the problem

With OpenACC reallocating a fortran pointer on a user type with allocatable
fails. 

Type is:
     type r2tab
             double precision, dimension(:,:), allocatable :: val
             integer :: dim1
             integer :: dim2
     end type r2tab

Variable in main to offload is:
type(r2tab), pointer :: tab=>null()


Gfortran 14.0 from master branch
commit 8d2793ef6b15dbdd347c854f663eb145af5ee593
Author: Marek Polacek <polacek@redhat.com>
Date:   Thu Mar 9 18:43:34 2023 -0500

But also 12.2.1 20230302 [OG12]

Short test case attached to reproduce.

Compilation with gfortran 14 using: 
gfortran -cpp -g -fopenacc testcase_begou.f90 -o testcase_begou

Execution output (wrong) with gfortran from master:

$ ./testcase_begou 
=================================================
======================= 1 =======================
=================================================
 =====>> ajoute: allocating on host and on device
 =====>> ajoute OK
 ====> usage in main: set array to 1 on device
  ====> usage in main OK
Before update from the device, on host (should be 0):       0.000000
After update from device, on host shoud be 100:     100.000000
 =====>> destroy datas on device and on host
 =====>> destroy OK
=================================================
======================= 2 =======================
=================================================
 =====>> ajoute: allocating on host and on device
 =====>> ajoute OK
 ====> usage in main: set array to 2 on device

libgomp: cuStreamSynchronize error: an illegal memory access was encountered




With gfortran 12.2.1 the error message is a little bit more detailed (only
error message below, standard output is the same):

libgomp: cuStreamSynchronize error: an illegal memory access was encountered

libgomp: cuModuleGetFunction (__do_global_dtors__entry) error: an illegal
memory access was encountered

libgomp: device finalization failed



Hosts used with GNU compilers: 
- AMD Epyc 7302 + Nvidia A100, CentOS8 
- i7-12700H + Nvidia T600, Alma Linux8


Code works on :
- AMD Epyc 7302 + Nvidia A100, CentOS8 with Nvfortran 22.5-0:
  nvfortran -acc=gpu,noautopar  -gpu=cc80 -Mpreprocess testcase_begou.f90 -o
testcase_begou

- i7-12700H + Nvidia T600, Alma Linux8 with Nvfortran 23.3-0:
- nvfortran -acc=gpu,noautopar  -gpu=cc75 -Mpreprocess testcase_begou.f90 -o
testcase_begou

- AMD EPYC 7542 + AMD MI 100 with  Cray ftn 14.0.2:
- ftn -g -hacc -hnoomp -eF testcase_begou.f90 -o testcase_begou

Correct output is:

=================================================
======================= 1 =======================
=================================================
 =====>> ajoute: allocating on host and on device
 =====>> ajoute OK
 ====> usage in main: set array to 1 on device
  ====> usage in main OK
Before update from the device, on host (should be 0):       0.000000
After update from device, on host shoud be 100:     100.000000
 =====>> destroy datas on device and on host
 =====>> destroy OK
=================================================
======================= 2 =======================
=================================================
 =====>> ajoute: allocating on host and on device
 =====>> ajoute OK
 ====> usage in main: set array to 2 on device
  ====> usage in main OK
Before update from the device, on host (should be 0):       0.000000
After update from device, on host shoud be 800:     800.000000
 =====>> destroy datas on device and on host
 =====>> destroy OK

Thanks

Patrick

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

* [Bug fortran/109699] With OpenACC reallocating a fortran pointer on a user type with allocatable fails.
  2023-05-02 15:28 [Bug fortran/109699] New: With OpenACC reallocating a fortran pointer on a user type with allocatable fails patrick.begou@univ-grenoble-alpes.fr
@ 2023-07-17 12:48 ` patrick.begou@univ-grenoble-alpes.fr
  0 siblings, 0 replies; 2+ messages in thread
From: patrick.begou@univ-grenoble-alpes.fr @ 2023-07-17 12:48 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Bégou <patrick.begou@univ-grenoble-alpes.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |openacc

--- Comment #1 from Patrick Bégou <patrick.begou@univ-grenoble-alpes.fr> ---
Just tested today as many new improvements have been added to gcc compilers.

$ gfortran --version
GNU Fortran (GCC) 14.0.0 20230717 (experimental)
...

Nvidia HPC is nvhpc/23.5

The problem still occur.

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

end of thread, other threads:[~2023-07-17 12:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-02 15:28 [Bug fortran/109699] New: With OpenACC reallocating a fortran pointer on a user type with allocatable fails patrick.begou@univ-grenoble-alpes.fr
2023-07-17 12:48 ` [Bug fortran/109699] " patrick.begou@univ-grenoble-alpes.fr

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