This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Implementing OpenACC's Fortran module


Hi!

In the OpenACC Runtime Library, acc_pcopyin and acc_pcreate are to be
aliases for acc_present_or_copyin and acc_present_or_create,
respectively.

This is implemented in openacc.f90 as follows:

On Tue, 19 Aug 2014 15:34:35 -0500, James Norris <jnorris@codesourcery.com> wrote:
> module openacc
>   use openacc_kinds
>   use openacc_internal
>   implicit none
> 
>   private
>   public :: openacc_version
> 
>   public :: [...], acc_present_or_copyin, acc_pcopyin, acc_create
>   public :: acc_present_or_create, acc_pcreate, [...]

>   interface acc_present_or_copyin
>     procedure :: acc_present_or_copyin_32_h
>     procedure :: acc_present_or_copyin_64_h
>     procedure :: acc_present_or_copyin_array_h
>   end interface
> 
>   interface acc_pcopyin
>     procedure :: acc_present_or_copyin_32_h
>     procedure :: acc_present_or_copyin_64_h
>     procedure :: acc_present_or_copyin_array_h
>   end interface

>   interface acc_present_or_create
>     procedure :: acc_present_or_create_32_h
>     procedure :: acc_present_or_create_64_h
>     procedure :: acc_present_or_create_array_h
>   end interface
> 
>   interface acc_pcreate
>     procedure :: acc_present_or_create_32_h
>     procedure :: acc_present_or_create_64_h
>     procedure :: acc_present_or_create_array_h
>   end interface

Even given my very limited knowledge of Fortran, what I understand this
to do is defer the acc_pcopyin and acc_pcreate interfaces to the existing
acc_present_or_copyin_*_h and acc_present_or_create_*_h routines:

> end module

> subroutine acc_present_or_copyin_32_h (a, len)
>   use iso_c_binding, only: c_int32_t, c_size_t
>   use openacc_internal, only: acc_present_or_copyin_l
>   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
>   type(*), dimension(*) :: a
>   integer(c_int32_t) len
>   call acc_present_or_copyin_l (a, int (len, kind=c_size_t))
> end subroutine
> 
> subroutine acc_present_or_copyin_64_h (a, len)
>   [...]
> end subroutine
> 
> subroutine acc_present_or_copyin_array_h (a)
>   [...]
> end subroutine

> subroutine acc_present_or_create_32_h (a, len)
>   use iso_c_binding, only: c_int32_t, c_size_t
>   use openacc_internal, only: acc_present_or_create_l
>   !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
>   type(*), dimension(*) :: a
>   integer(c_int32_t) len
>   call acc_present_or_create_l (a, int (len, kind=c_size_t))
> end subroutine
> 
> subroutine acc_present_or_create_64_h (a, len)
>   [...]
> end subroutine
> 
> subroutine acc_present_or_create_array_h (a)
>   [...]
> end subroutine

What are we to do in the openacc_lib.h file, however?  Here we currently
have the acc_pcopyin and acc_pcreate interfaces refer to acc_pcopyin_*_h
and acc_pcreate_*_h routines -- which don't exist.  Can we have them
refer to the acc_present_or_copyin_*_h and acc_present_or_create_*_h
routines instead?

>       interface acc_present_or_copyin
>         subroutine acc_present_or_copyin_32_h (a, len)
>           use iso_c_binding, only: c_int32_t
>           !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
>           type(*), dimension(*) :: a
>           integer(c_int32_t) len
>         end subroutine
>   
>         subroutine acc_present_or_copyin_64_h (a, len)
>           use iso_c_binding, only: c_int64_t
>           !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
>           type(*), dimension(*) :: a
>           integer(c_int64_t) len
>         end subroutine
>   
>         subroutine acc_present_or_copyin_array_h (a)
>           class(*), dimension(..) :: a
>           end subroutine
>       end interface
> 
>       interface acc_pcopyin
>         subroutine acc_pcopyin_32_h (a, len)
>           use iso_c_binding, only: c_int32_t
>           !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
>           type(*), dimension(*) :: a
>           integer(c_int32_t) len
>         end subroutine
>   
>         subroutine acc_pcopyin_64_h (a, len)
>           use iso_c_binding, only: c_int64_t
>           !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
>           type(*), dimension(*) :: a
>           integer(c_int64_t) len
>         end subroutine
>   
>         subroutine acc_pcopyin_array_h (a)
>           class(*), dimension(..) :: a
>           end subroutine
>       end interface

>       interface acc_present_or_create
>         subroutine acc_present_or_create_32_h (a, len)
>           use iso_c_binding, only: c_int32_t
>           !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
>           type(*), dimension(*) :: a
>           integer(c_int32_t) len
>         end subroutine
>   
>         subroutine acc_present_or_create_64_h (a, len)
>           use iso_c_binding, only: c_int64_t
>           !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
>           type(*), dimension(*) :: a
>           integer(c_int64_t) len
>         end subroutine
>   
>         subroutine acc_present_or_create_array_h (a)
>           class(*), dimension(..) :: a
>           end subroutine
>       end interface
> 
>       interface acc_pcreate
>         subroutine acc_pcreate_32_h (a, len)
>           use iso_c_binding, only: c_int32_t
>           !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
>           type(*), dimension(*) :: a
>           integer(c_int32_t) len
>         end subroutine
>   
>         subroutine acc_pcreate_64_h (a, len)
>           use iso_c_binding, only: c_int64_t
>           !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
>           type(*), dimension(*) :: a
>           integer(c_int64_t) len
>         end subroutine
>   
>         subroutine acc_pcreate_array_h (a)
>           class(*), dimension(..) :: a
>           end subroutine
>       end interface


GrÃÃe,
 Thomas

Attachment: pgpL88fuavuNk.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]