This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] OpenACC routines in fortran modules
- From: Tobias Burnus <tobias dot burnus at physik dot fu-berlin dot de>
- To: Cesar Philippidis <cesar at codesourcery dot com>, gcc-patches at gcc dot gnu dot org, fortran at gcc dot gnu dot org, Jakub Jelinek <jakub at redhat dot com>
- Date: Thu, 28 Jul 2016 11:55:37 +0200
- Subject: Re: [PATCH] OpenACC routines in fortran modules
- Authentication-results: sourceware.org; auth=none
Cesar Philippidis wrote:
> It turns out that the acc routine parallelism isn't being recorded in
> fortran .mod files. This is a problem because then the ME can't validate
> if a routine has compatible parallelism with the call site.
Nothing against saving such information in .mod files. However, I wonder
whether it can happen that one places such an 'acc routine' outside of a
module in one file - and still accesses it from another file. In the simple
non-ACC case, one can have:
!----- one.f90 ----
subroutine foo()
print *, "abc"
end subroutine foo
!---- two.f90 ---
program example
call foo()
end program example
where "foo()" is torn in without any information about it (except that it
is a subroutine, does not require an explicit interface, and takes no
arguments).
I don't know whether the ACC spec requires an explicit interface in that
case (i.e. for acc routines); I bet it does - or at least should. In that
case, something like the following would be valid - and should be supported
as well. (I don't know whether it currently is.)
!----- one.f90 ----
subroutine foo()
!$acc routine gang
.... ! something
end subroutine foo
!---- two.f90 ---
program example
INTERFACE
subroutine foo()
!$acc routine gang
! Nothing here
end subroutine foo
END INTERFACE
call foo()
end program example
Namely, a replication of the declaration of the procedure, including
the "acc routine", in the 'interface'.
(If one concats the two files, I would also expect an error with -fopenacc,
if the "acc routine" doesn't match between "foo" and the "foo" in the
"interface" block.)
Otherwise: Have you checked whether an unmodified gfortran still accepts the
.mod file written by the patched gfortran - and vice versa? Especially if
-fopenacc is not used, backward compatibility of .mod files is a goal.
(Even though we often have to bump the .mod version for major releases.)
Cheers,
Tobias