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 Thomas, dear all,

attached is a draft version of openacc_lib.h and openacc.f90. See TODO for the missing bits. Note that the "openacc.f90" code produces both a module file (.mod) and object code, which has to be linked into the library. Those stub functions should call the C version of the function.Those files require my trunk patch r213079 of today.

Please review - it is simple to make copy'n'paste mistakes. Otherwise, how does it look like?

Tobias
!  Copyright (C) 2014 Free Software Foundation, Inc.
!  Contributed by Tobias Burnus <burnus@net-b.de>

!  This file is part of the GNU OpenMP Library (libgomp).

!  Libgomp is free software; you can redistribute it and/or modify it
!  under the terms of the GNU General Public License as published by
!  the Free Software Foundation; either version 3, or (at your option)
!  any later version.

!  Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
!  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
!  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
!  more details.

!  Under Section 7 of GPL version 3, you are granted additional
!  permissions described in the GCC Runtime Library Exception, version
!  3.1, as published by the Free Software Foundation.

!  You should have received a copy of the GNU General Public License and
!  a copy of the GCC Runtime Library Exception along with this program;
!  see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
!  <http://www.gnu.org/licenses/>.

! NOTE: Due to the use of dimension(..), the code only works when compiled
! with -std=f2008ts/gnu/legacy but not with other standard settings.
! Alternatively, the user can use the module version, which permits
! compilation with -std=f95.

      integer, parameter :: openacc_version = 201306
      integer, parameter :: acc_device_kind = 4
      integer, parameter :: acc_handle_kind = 4

      ! TODO:
      ! - Add acc_async_noval and acc_async_sync
      ! - Add integer parameters to describe types of accelerators

      interface
        function acc_get_num_devices (devicetype) bind(C)
          import :: acc_device_kind
          integer(acc_device_kind) :: devicetype
          integer :: acc_get_num_devices
        end function acc_get_num_devices

        subroutine acc_set_device_type (devicetype) bind(C)
          import :: acc_device_kind
          integer(acc_device_kind) :: devicetype
        end subroutine acc_set_device_type

        function acc_get_device_type () bind(C)
          import :: acc_device_kind
          integer(acc_device_kind) :: acc_get_device_type
        end function acc_get_device_type

        subroutine acc_set_device_num (devicenum, devicetype) bind(C)
          import :: acc_device_kind
          integer :: devicenum
          integer(acc_device_kind) :: devicetype
        end subroutine acc_set_device_num

        function acc_get_device_num (devicetype) bind(C)
          import :: acc_device_kind
          integer(acc_device_kind) :: devicetype
          integer :: acc_get_device_num
        end function acc_get_device_num

        function acc_async_test (arg) bind(C)
          import :: acc_handle_kind
          integer(acc_handle_kind) :: arg
          logical :: acc_async_test
        end function acc_async_test

        function acc_async_test_all () bind(C)
          logical :: acc_async_test_all
        end function acc_async_test_all

        subroutine acc_wait (arg) bind(C)
          import :: acc_handle_kind
          integer(acc_handle_kind) :: arg
        end subroutine acc_wait

        subroutine acc_wait_async (arg, async) bind(C)
          import :: acc_handle_kind
          integer(acc_handle_kind) :: arg, async
        end subroutine acc_wait_async

        subroutine acc_wait_all () bind(C)
        end subroutine acc_wait_all

        subroutine acc_wait_all_async (async) bind(C)
          import :: acc_handle_kind
          integer(acc_handle_kind) :: async
        end subroutine acc_wait_all_async

        subroutine acc_init (devicetype) bind(C)
          import :: acc_device_kind
          integer(acc_device_kind) :: devicetype
        end subroutine acc_init

        subroutine acc_shutdown (devicetype) bind(C)
          import :: acc_device_kind
          integer(acc_device_kind) :: devicetype
        end subroutine acc_shutdown

        function acc_on_device (devicetype) bind(C)
          import :: acc_device_kind
          integer(acc_device_kind) :: devicetype
          logical :: acc_on_device
        end function acc_on_device

        ! acc_malloc: Only available in C/C++
        ! acc_free: Only available in C/C++
      end interface

      ! As vendor extension, the following code supports both 32bit and 64bit
      ! arguments for "size"; the OpenACC standard only permits default-kind
      ! integers, which are of kind 4 (i.e. 32 bits).
      ! Additionally, the two-argument version also takes arrays as argument.
      ! and the one argument version also scalars. Note that the code assumes
      ! that the arrays are contiguous.

      interface acc_copyin
        subroutine acc_copyin_32 (a, len) bind(C)
          use iso_c_binding, only: c_int32_t
          !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
          type(*), dimension(*) :: a
          integer(c_int32_t), value :: len
        end subroutine acc_copyin_32
        subroutine acc_copyin_64 (a, len) bind(C)
          use iso_c_binding, only: c_int64_t
          !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
          type(*), dimension(*) :: a
          integer(c_int64_t), value :: len
        end subroutine acc_copyin_64
        subroutine acc_copyin_array (a) bind(C)
          type(*), dimension(..) :: a
        end subroutine acc_copyin_array
      end interface acc_copyin

      interface acc_present_or_copyin
        subroutine acc_present_or_copyin_32 (a, len) bind(C)
          use iso_c_binding, only: c_int32_t
          !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
          type(*), dimension(*) :: a
          integer(c_int32_t), value :: len
        end subroutine acc_present_or_copyin_32
        subroutine acc_present_or_copyin_64 (a, len) bind(C)
          use iso_c_binding, only: c_int64_t
          !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
          type(*), dimension(*) :: a
          integer(c_int64_t), value :: len
        end subroutine acc_present_or_copyin_64
        subroutine acc_present_or_copyin_array (a) bind(C)
          type(*), dimension(..) :: a
        end subroutine acc_present_or_copyin_array
      end interface acc_present_or_copyin

      interface acc_pcopyin
        procedure :: acc_present_or_copyin_32
        procedure :: acc_present_or_copyin_64
        procedure :: acc_present_or_copyin_array
      end interface acc_pcopyin

      interface acc_create
        subroutine acc_create_32 (a, len) bind(C)
          use iso_c_binding, only: c_int32_t
          !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
          type(*), dimension(*) :: a
          integer(c_int32_t), value :: len
        end subroutine acc_create_32
        subroutine acc_create_64 (a, len) bind(C)
          use iso_c_binding, only: c_int64_t
          !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
          type(*), dimension(*) :: a
          integer(c_int64_t), value :: len
        end subroutine acc_create_64
        subroutine acc_create_array(a) bind(C)
          type(*), dimension(..) :: a
        end subroutine acc_create_array
      end interface acc_create

      interface acc_present_or_create
        subroutine acc_present_or_create_32 (a, len) bind(C)
          use iso_c_binding, only: c_int32_t
          !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
          type(*), dimension(*) :: a
          integer(c_int32_t), value :: len
        end subroutine acc_present_or_create_32
        subroutine acc_present_or_create_64 (a, len) bind(C)
          use iso_c_binding, only: c_int64_t
          !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
          type(*), dimension(*) :: a
          integer(c_int64_t), value :: len
        end subroutine acc_present_or_create_64
        subroutine acc_present_or_create_array (a) bind(C)
          type(*), dimension(..) :: a
        end subroutine acc_present_or_create_array
      end interface acc_present_or_create

      interface acc_pcreate
        procedure :: acc_present_or_create_32
        procedure :: acc_present_or_create_64
        procedure :: acc_present_or_create_array
      end interface acc_pcreate

      interface acc_copyout
        subroutine acc_copyout_32 (a, len) bind(C)
          use iso_c_binding, only: c_int32_t
          !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
          type(*), dimension(*) :: a
          integer(c_int32_t), value :: len
        end subroutine acc_copyout_32
        subroutine acc_copyout_64 (a, len) bind(C)
          use iso_c_binding, only: c_int64_t
          !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
          type(*), dimension(*) :: a
          integer(c_int64_t), value :: len
        end subroutine acc_copyout_64
        subroutine acc_copyout_array (a) bind(C)
          type(*), dimension(..) :: a
        end subroutine acc_copyout_array
      end interface acc_copyout

      interface acc_delete
        subroutine acc_delete_32 (a, len) bind(C)
          use iso_c_binding, only: c_int32_t
          !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
          type(*), dimension(*) :: a
          integer(c_int32_t), value :: len
        end subroutine acc_delete_32
        subroutine acc_delete_64 (a, len) bind(C)
          use iso_c_binding, only: c_int64_t
          !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
          type(*), dimension(*) :: a
          integer(c_int64_t), value :: len
        end subroutine acc_delete_64
        subroutine acc_delete_array (a) bind(C)
          type(*), dimension(..) :: a
        end subroutine acc_delete_array
      end interface acc_delete

      interface acc_update_device
        subroutine acc_update_device_32 (a, len) bind(C)
          use iso_c_binding, only: c_int32_t
          !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
          type(*), dimension(*) :: a
          integer(c_int32_t), value :: len
        end subroutine acc_update_device_32
        subroutine acc_update_device_64 (a, len) bind(C)
          use iso_c_binding, only: c_int64_t
          !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
          type(*), dimension(*) :: a
          integer(c_int64_t), value :: len
        end subroutine acc_update_device_64
        subroutine acc_update_device_array (a) bind(C)
          type(*), dimension(..) :: a
        end subroutine acc_update_device_array
      end interface acc_update_device

      interface acc_update_self
        subroutine acc_update_self_32 (a, len) bind(C)
          use iso_c_binding, only: c_int32_t
          !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
          type(*), dimension(*) :: a
          integer(c_int32_t), value :: len
        end subroutine acc_update_self_32
        subroutine acc_update_self_64 (a, len) bind(C)
          use iso_c_binding, only: c_int64_t
          !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
          type(*), dimension(*) :: a
          integer(c_int64_t), value :: len
        end subroutine acc_update_self_64
        subroutine acc_update_self_array (a) bind(C)
          type(*), dimension(..) :: a
        end subroutine acc_update_self_array
      end interface acc_update_self

      ! acc_map_data: Only available in C/C++
      ! acc_unmap_data: Only available in C/C++
      ! acc_deviceptr: Only available in C/C++
      ! acc_hostptr: Only available in C/C++

      interface acc_is_present
        subroutine acc_is_present_32 (a, len) bind(C)
          use iso_c_binding, only: c_int32_t
          !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
          type(*), dimension(*) :: a
          integer(c_int32_t), value :: len
        end subroutine acc_is_present_32
        subroutine acc_is_present_64 (a, len) bind(C)
          use iso_c_binding, only: c_int64_t
          !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
          type(*), dimension(*) :: a
          integer(c_int64_t), value :: len
        end subroutine acc_is_present_64
        subroutine acc_is_present_array (a) bind(C)
          type(*), dimension(..) :: a
        end subroutine acc_is_present_array
      end interface acc_is_present

      ! acc_memcpy_to_device: Only available in C/C++
      ! acc_memcpy_from_device: Only available in C/C++
!  Copyright (C) 2014 Free Software Foundation, Inc.
!  Contributed by Tobias Burnus <burnus@net-b.de>

!  This file is part of the GNU OpenMP Library (libgomp).

!  Libgomp is free software; you can redistribute it and/or modify it
!  under the terms of the GNU General Public License as published by
!  the Free Software Foundation; either version 3, or (at your option)
!  any later version.

!  Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
!  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
!  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
!  more details.

!  Under Section 7 of GPL version 3, you are granted additional
!  permissions described in the GCC Runtime Library Exception, version
!  3.1, as published by the Free Software Foundation.

!  You should have received a copy of the GNU General Public License and
!  a copy of the GCC Runtime Library Exception along with this program;
!  see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
!  <http://www.gnu.org/licenses/>.

module openacc
  use iso_c_binding, only: c_size_t, c_int32_t, c_int64_t
  implicit none

  private
  public :: openacc_version, acc_device_kind, acc_handle_kind

  public :: acc_get_num_devices, acc_set_device_type, acc_get_device_type
  public :: acc_set_device_num, acc_get_device_num, acc_async_test
  public :: acc_async_test_all, acc_wait, acc_wait_async, acc_wait_all
  public :: acc_wait_all_async, acc_init, acc_shutdown, acc_on_device
  public :: acc_copyin, acc_present_or_copyin, acc_pcopyin, acc_create
  public :: acc_present_or_create, acc_pcreate, acc_copyout, acc_delete
  public :: acc_update_device, acc_update_self, acc_is_present

  integer, parameter :: openacc_version = 201306
  integer, parameter :: acc_device_kind = 4
  integer, parameter :: acc_handle_kind = 4

  ! TODO:
  ! - Add acc_async_noval and acc_async_sync
  ! - Add integer parameters to describe types of accelerators
  ! - Check whether the library calls are fine.

  interface
    function acc_get_num_devices (devicetype) bind(C)
      import :: acc_device_kind
      integer(acc_device_kind) :: devicetype
      integer :: acc_get_num_devices
    end function acc_get_num_devices

    subroutine acc_set_device_type (devicetype) bind(C)
      import :: acc_device_kind
      integer(acc_device_kind) :: devicetype
    end subroutine acc_set_device_type

    function acc_get_device_type () bind(C)
      import :: acc_device_kind
      integer(acc_device_kind) :: acc_get_device_type
    end function acc_get_device_type

    subroutine acc_set_device_num (devicenum, devicetype) bind(C)
      import :: acc_device_kind
      integer :: devicenum
      integer(acc_device_kind) :: devicetype
    end subroutine acc_set_device_num

    function acc_get_device_num (devicetype) bind(C)
      import :: acc_device_kind
      integer(acc_device_kind) :: devicetype
      integer :: acc_get_device_num
    end function acc_get_device_num

    function acc_async_test (arg) bind(C)
      import :: acc_handle_kind
      integer(acc_handle_kind) :: arg
      logical :: acc_async_test
    end function acc_async_test

    function acc_async_test_all () bind(C)
      logical :: acc_async_test_all
    end function acc_async_test_all

    subroutine acc_wait (arg) bind(C)
      import :: acc_handle_kind
      integer(acc_handle_kind) :: arg
    end subroutine acc_wait

    subroutine acc_wait_async (arg, async) bind(C)
      import :: acc_handle_kind
      integer(acc_handle_kind) :: arg, async
    end subroutine acc_wait_async

    subroutine acc_wait_all () bind(C)
    end subroutine acc_wait_all

    subroutine acc_wait_all_async (async) bind(C)
      import :: acc_handle_kind
      integer(acc_handle_kind) :: async
    end subroutine acc_wait_all_async

    subroutine acc_init (devicetype) bind(C)
      import :: acc_device_kind
      integer(acc_device_kind) :: devicetype
    end subroutine acc_init

    subroutine acc_shutdown (devicetype) bind(C)
      import :: acc_device_kind
      integer(acc_device_kind) :: devicetype
    end subroutine acc_shutdown

    function acc_on_device (devicetype) bind(C)
      import :: acc_device_kind
      integer(acc_device_kind) :: devicetype
      logical :: acc_on_device
    end function acc_on_device

    ! acc_malloc: Only available in C/C++
    ! acc_free: Only available in C/C++
  end interface

  ! As vendor extension, the following code supports both 32bit and 64bit
  ! arguments for "size"; the OpenACC standard only permits default-kind
  ! integers, which are of kind 4 (i.e. 32 bits).
  ! Additionally, the two-argument version also takes arrays as argument.
  ! and the one argument version also scalars. Note that the code assumes
  ! that the arrays are contiguous.

  interface acc_copyin
    procedure :: acc_copyin_32
    procedure :: acc_copyin_64
    procedure :: acc_copyin_array
  end interface acc_copyin

  interface acc_present_or_copyin
    procedure :: acc_present_or_copyin_32
    procedure :: acc_present_or_copyin_64
    procedure :: acc_present_or_copyin_array
  end interface acc_present_or_copyin

  interface acc_pcopyin
    procedure :: acc_present_or_copyin_32
    procedure :: acc_present_or_copyin_64
    procedure :: acc_present_or_copyin_array
  end interface acc_pcopyin

  interface acc_create
    procedure :: acc_create_32
    procedure :: acc_create_64
    procedure :: acc_create_array
  end interface acc_create

  interface acc_present_or_create
    procedure :: acc_present_or_create_32
    procedure :: acc_present_or_create_64
    procedure :: acc_present_or_create_array
  end interface acc_present_or_create

  interface acc_pcreate
    procedure :: acc_present_or_create_32
    procedure :: acc_present_or_create_64
    procedure :: acc_present_or_create_array
  end interface acc_pcreate

  interface acc_copyout
    procedure :: acc_copyout_32
    procedure :: acc_copyout_64
    procedure :: acc_copyout_array
  end interface acc_copyout

  interface acc_delete
    procedure :: acc_delete_32
    procedure :: acc_delete_64
    procedure :: acc_delete_array
  end interface acc_delete

  interface acc_update_device
    procedure :: acc_update_device_32
    procedure :: acc_update_device_64
    procedure :: acc_update_device_array
  end interface acc_update_device

  interface acc_update_self
    procedure :: acc_update_self_32
    procedure :: acc_update_self_64
    procedure :: acc_update_self_array
  end interface acc_update_self

  ! acc_map_data: Only available in C/C++
  ! acc_unmap_data: Only available in C/C++
  ! acc_deviceptr: Only available in C/C++
  ! acc_hostptr: Only available in C/C++

  interface acc_is_present
    procedure :: acc_is_present_32
    procedure :: acc_is_present_64
    procedure :: acc_is_present_array
  end interface acc_is_present

  ! acc_memcpy_to_device: Only available in C/C++
  ! acc_memcpy_from_device: Only available in C/C++

  ! The actual library implementations, matching the C version
  interface
    subroutine acc_copyin_lib (a, len) bind(C, name="acc_copyin")
      use iso_c_binding, only: c_size_t
      !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
      type(*), dimension(*) :: a
      integer(c_size_t), value :: len
    end subroutine acc_copyin_lib
    subroutine acc_present_or_copyin_lib (a, len) &
        bind(C, name="acc_present_or_copyin")
      use iso_c_binding, only: c_size_t
      !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
      type(*), dimension(*) :: a
      integer(c_size_t), value :: len
    end subroutine acc_present_or_copyin_lib
    subroutine acc_create_lib (a, len) &
        bind(C, name="acc_create")
      use iso_c_binding, only: c_size_t
      !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
      type(*), dimension(*) :: a
      integer(c_size_t), value :: len
    end subroutine acc_create_lib
    subroutine acc_present_or_create_lib (a, len) &
        bind(C, name="acc_present_or_create")
      use iso_c_binding, only: c_size_t
      !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
      type(*), dimension(*) :: a
      integer(c_size_t), value :: len
    end subroutine acc_present_or_create_lib
    subroutine acc_copyout_lib (a, len) &
        bind(C, name="acc_copyout")
      use iso_c_binding, only: c_size_t
      !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
      type(*), dimension(*) :: a
      integer(c_size_t), value :: len
    end subroutine acc_copyout_lib
    subroutine acc_delete_lib (a, len) &
        bind(C, name="acc_delete")
      use iso_c_binding, only: c_size_t
      !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
      type(*), dimension(*) :: a
      integer(c_size_t), value :: len
    end subroutine acc_delete_lib
    subroutine acc_update_device_lib (a, len) &
        bind(C, name="acc_update_device")
      use iso_c_binding, only: c_size_t
      !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
      type(*), dimension(*) :: a
      integer(c_size_t), value :: len
    end subroutine acc_update_device_lib
    subroutine acc_update_self_lib (a, len) &
        bind(C, name="acc_update_self")
      use iso_c_binding, only: c_size_t
      !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
      type(*), dimension(*) :: a
      integer(c_size_t), value :: len
    end subroutine acc_update_self_lib
    subroutine acc_is_present_lib (a, len) &
        bind(C, name="acc_is_present")
      use iso_c_binding, only: c_size_t
      !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
      type(*), dimension(*) :: a
      integer(c_size_t), value :: len
    end subroutine acc_is_present_lib
  end interface

contains  ! Implement the wrapper procedures

  subroutine acc_copyin_32 (a, len) bind(C)
    !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
    type(*), dimension(*) :: a
    integer(c_int32_t), value :: len
    call acc_copyin_lib (a, int (len, kind=c_size_t))
  end subroutine acc_copyin_32

  subroutine acc_copyin_64 (a, len) bind(C)
    !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
    type(*), dimension(*) :: a
    integer(c_int64_t), value :: len
    call acc_copyin_lib (a, int (len, kind=c_size_t))
  end subroutine acc_copyin_64

  subroutine acc_copyin_array (a) bind(C)
    type(*), dimension(..) :: a
    call acc_copyin_lib (a, int (sizeof (a), kind=c_size_t))
  end subroutine acc_copyin_array


  subroutine acc_present_or_copyin_32 (a, len) bind(C)
    !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
    type(*), dimension(*) :: a
    integer(c_int32_t), value :: len
    call acc_present_or_copyin_lib (a, int (len, kind=c_size_t))
  end subroutine acc_present_or_copyin_32

  subroutine acc_present_or_copyin_64 (a, len) bind(C)
    !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
    type(*), dimension(*) :: a
    integer(c_int64_t), value :: len
    call acc_present_or_copyin_lib (a, int (len, kind=c_size_t))
  end subroutine acc_present_or_copyin_64

  subroutine acc_present_or_copyin_array (a) bind(C)
    type(*), dimension(..) :: a
    call acc_present_or_copyin_lib (a, int (sizeof (a), kind=c_size_t))
  end subroutine acc_present_or_copyin_array


  subroutine acc_create_32 (a, len) bind(C)
    !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
    type(*), dimension(*) :: a
    integer(c_int32_t), value :: len
    call acc_create_lib (a, int (len, kind=c_size_t))
  end subroutine acc_create_32

  subroutine acc_create_64 (a, len) bind(C)
    !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
    type(*), dimension(*) :: a
    integer(c_int64_t), value :: len
    call acc_create_lib (a, int (len, kind=c_size_t))
  end subroutine acc_create_64

  subroutine acc_create_array(a) bind(C)
    type(*), dimension(..) :: a
    call acc_create_lib (a, int (sizeof (a), kind=c_size_t))
  end subroutine acc_create_array


  subroutine acc_present_or_create_32 (a, len) bind(C)
    !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
    type(*), dimension(*) :: a
    integer(c_int32_t), value :: len
    call acc_present_or_create_lib (a, int (len, kind=c_size_t))
  end subroutine acc_present_or_create_32

  subroutine acc_present_or_create_64 (a, len) bind(C)
    !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
    type(*), dimension(*) :: a
    integer(c_int64_t), value :: len
    call acc_present_or_create_lib (a, int (len, kind=c_size_t))
  end subroutine acc_present_or_create_64

  subroutine acc_present_or_create_array (a) bind(C)
    type(*), dimension(..) :: a
    call acc_present_or_create_lib (a, int (sizeof (a), kind=c_size_t))
  end subroutine acc_present_or_create_array


  subroutine acc_copyout_32 (a, len) bind(C)
    !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
    type(*), dimension(*) :: a
    integer(c_int32_t), value :: len
    call acc_copyout_lib (a, int (len, kind=c_size_t))
  end subroutine acc_copyout_32

  subroutine acc_copyout_64 (a, len) bind(C)
    !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
    type(*), dimension(*) :: a
    integer(c_int64_t), value :: len
    call acc_copyout_lib (a, int (len, kind=c_size_t))
  end subroutine acc_copyout_64

  subroutine acc_copyout_array (a) bind(C)
    type(*), dimension(..) :: a
    call acc_copyout_lib (a, int (sizeof (a), kind=c_size_t))
  end subroutine acc_copyout_array


  subroutine acc_delete_32 (a, len) bind(C)
    !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
    type(*), dimension(*) :: a
    integer(c_int32_t), value :: len
    call acc_delete_lib (a, int (len, kind=c_size_t))
  end subroutine acc_delete_32

  subroutine acc_delete_64 (a, len) bind(C)
    !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
    type(*), dimension(*) :: a
    integer(c_int64_t), value :: len
    call acc_delete_lib (a, int (len, kind=c_size_t))
  end subroutine acc_delete_64

  subroutine acc_delete_array (a) bind(C)
    type(*), dimension(..) :: a
    call acc_delete_lib (a, int (sizeof (a), kind=c_size_t))
  end subroutine acc_delete_array


  subroutine acc_update_device_32 (a, len) bind(C)
    !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
    type(*), dimension(*) :: a
    integer(c_int32_t), value :: len
    call acc_update_device_lib (a, int (len, kind=c_size_t))
  end subroutine acc_update_device_32

  subroutine acc_update_device_64 (a, len) bind(C)
    !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
    type(*), dimension(*) :: a
    integer(c_int64_t), value :: len
    call acc_update_device_lib (a, int (len, kind=c_size_t))
  end subroutine acc_update_device_64

  subroutine acc_update_device_array (a) bind(C)
    type(*), dimension(..) :: a
    call acc_update_device_lib (a, int (sizeof (a), kind=c_size_t)) 
  end subroutine acc_update_device_array


  subroutine acc_update_self_32 (a, len) bind(C)
    !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
    type(*), dimension(*) :: a
    integer(c_int32_t), value :: len
    call acc_update_self_lib (a, int (len, kind=c_size_t))
  end subroutine acc_update_self_32

  subroutine acc_update_self_64 (a, len) bind(C)
    !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
    type(*), dimension(*) :: a
    integer(c_int64_t), value :: len
    call acc_update_self_lib (a, int (len, kind=c_size_t))
  end subroutine acc_update_self_64

  subroutine acc_update_self_array (a) bind(C)
    type(*), dimension(..) :: a
    call acc_update_self_lib (a, int (sizeof (a), kind=c_size_t))
  end subroutine acc_update_self_array


  subroutine acc_is_present_32 (a, len) bind(C)
    !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
    type(*), dimension(*) :: a
    integer(c_int32_t), value :: len
    call acc_is_present_lib (a, int (len, kind=c_size_t))
  end subroutine acc_is_present_32

  subroutine acc_is_present_64 (a, len) bind(C)
    !GCC$ ATTRIBUTES NO_ARG_CHECK :: a
    type(*), dimension(*) :: a
    integer(c_int64_t), value :: len
    call acc_is_present_lib (a, int (len, kind=c_size_t))
  end subroutine acc_is_present_64

  subroutine acc_is_present_array (a) bind(C)
    type(*), dimension(..) :: a
    call acc_is_present_lib (a, int (sizeof (a), kind=c_size_t))
  end subroutine acc_is_present_array

end module openacc

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