Implementing OpenACC's Fortran module

Tobias Burnus tobias.burnus@physik.fu-berlin.de
Tue Jul 29 14:06:00 GMT 2014


James,

On Tue, Jul 29, 2014 at 07:57:37AM -0500, James Norris wrote:
> Attached is my working version of openacc.f90. It is based on the
> version you distributed  with some changes pertaining to the C
> binding of variables. I've  also done a couple of things
> on your 'TODO' list. Some preliminary testing of the code has been
> performed, however, there is still more testing to be done.

Thanks! In openacc_kinds, you should add "private" otherwise
you also export "int32". Additionally, you do not list acc_device_kind,
acc_handle_kind, acc_async_noval and acc_async_sync as "public".

 
> With regard to the file openacc_lib.h, I felt the intention of this
> file was to provide interfaces
> for legacy / 'dusty deck' Fortran, i.e., Fortran 77. Since the 'use'
> statement was made available
> in Fortran 90, the file openacc.f90 would be the preferred file /
> method for accessing the
> OpenACC interfaces. However, a means was still needed for Fortran
> versions prior to Fortran
> 90. Therefore, openacc_lib.h would provide those interfaces, albeit
> a subset of the entire set
> of the available interfaces given the limitations of Fortran 77.

I concur. However, many users confuse Fortran 77 with fixed-form
source code. As modern Fortran is largely backward compatible to
Fortran 77, compiler vendors tend to offer a single compiler for
all Fortran code. Thus, some users believe they use Fortran 77 with
a Fortran 77 compiler - while in reality they use a newer Fortran
compiler - and their code probably even contains some features of
newer Fortran standard. (And surely it uses vendor extensions, some
of which might have been added in later versions of the standard.)

Thus, I wouldn't be surprised if there will be some existing code
which uses "include 'openacc_lib.h'" even though all their compilers
would perfectly well handle "use openacc" as well.

Hence, I think it doesn't harm to also include openacc_lib.h. My
version of it won't compile with -std=f90/f95/f2003/f2008 but given
that Fortran-77-like code is usually not standard conform, they
wouldn't be able to compile with those -std= anyhow.

Still, one can wonder why new language additions like OpenACC still
come with pre-Fortran-90 solution. MPIv3.0 made a cut and offers
the newst features only as module.

Tobias



More information about the Fortran mailing list