Commit 8d1a1cb1 by Tobias Burnus

libgomp: Fixes + cleanup for OpenACC's Fortran module + openacc_lib.h

2020-02-19  Tobias Burnus  <tobias@codesourcery.com>

	* .gitattributes: New; whitespace handling for Fortran's openacc_lib.h.
	* config/accel/openacc.f90 (openacc_kinds): Add acc_device_current.
	(openacc_internal, acc_on_device_h): Fix argument name; minor cleanup.
	* libgomp.texi (Enabling OpenACC): No longer mark as experimental.
	(acc_set_device_num): Fix Fortran argument name, use same name for C.
	(acc_get_property): Update Fortran interface to post-OpenACC 3.0
	corrections; add note about the previous interface and named constant.
	(OpenACC library and environment variables): Fix two typos.
	* openacc.f90: Use for all procedures the argument names from the spec
	as for …_h they are user visible.
	(openacc_kinds): Rename acc_device_property to
	acc_device_property_kinds and change value to int32 ; and update users.
	Re-add acc_device_property for for backward compatibility.
	(acc_get_property_string_h): Clean up as acc_device_property_kind
	changed.
	(acc_get_property_h): Likewise and return c_size_t instead of
	acc_device_property.
	(openacc): Also export acc_device_property_kinds.
	(acc_async_test_h, acc_async_test_all_h, acc_on_device_h,
	acc_is_present_32_h, acc_is_present_64_h): Simplify logical-return-value
	handling; check against /= 0 instead of == 1 to match C.
	* openacc_lib.h: Use for all procedures the argument names from the spec
	as for …_h they are user visible. Place !GCC$ into the first column to
	be active also for fixed-form souce form.
	(acc_device_current, acc_device_property_kind, acc_device_property,
	acc_property_memory, acc_property_free_memory, acc_property_name,
	acc_property_vendor, acc_property_driver): New named constants.
	(acc_get_property, acc_get_property_string): New generic interface.
parent bfe78b08
# For the Fortran file, complain about tabs
openacc_lib.h whitespace=tab-in-indent,space-before-tab,trailing-space
2020-02-19 Tobias Burnus <tobias@codesourcery.com>
* .gitattributes: New; whitespace handling for Fortran's openacc_lib.h.
* config/accel/openacc.f90 (openacc_kinds): Add acc_device_current.
(openacc_internal, acc_on_device_h): Fix argument name; minor cleanup.
* libgomp.texi (Enabling OpenACC): No longer mark as experimental.
(acc_set_device_num): Fix Fortran argument name, use same name for C.
(acc_get_property): Update Fortran interface to post-OpenACC 3.0
corrections; add note about the previous interface and named constant.
(OpenACC library and environment variables): Fix two typos.
* openacc.f90: Use for all procedures the argument names from the spec
as for …_h they are user visible.
(openacc_kinds): Rename acc_device_property to
acc_device_property_kinds and change value to int32 ; and update users.
Re-add acc_device_property for for backward compatibility.
(acc_get_property_string_h): Clean up as acc_device_property_kind
changed.
(acc_get_property_h): Likewise and return c_size_t instead of
acc_device_property.
(openacc): Also export acc_device_property_kinds.
(acc_async_test_h, acc_async_test_all_h, acc_on_device_h,
acc_is_present_32_h, acc_is_present_64_h): Simplify logical-return-value
handling; check against /= 0 instead of == 1 to match C.
* openacc_lib.h: Use for all procedures the argument names from the spec
as for …_h they are user visible. Place !GCC$ into the first column to
be active also for fixed-form souce form.
(acc_device_current, acc_device_property_kind, acc_device_property,
acc_property_memory, acc_property_free_memory, acc_property_name,
acc_property_vendor, acc_property_driver): New named constants.
(acc_get_property, acc_get_property_string): New generic interface.
2020-02-13 Frederik Harwath <frederik@codesourcery.com> 2020-02-13 Frederik Harwath <frederik@codesourcery.com>
PR libgomp/93481 PR libgomp/93481
......
...@@ -44,6 +44,7 @@ module openacc_kinds ...@@ -44,6 +44,7 @@ module openacc_kinds
integer, parameter :: acc_device_kind = int32 integer, parameter :: acc_device_kind = int32
! Keep in sync with include/gomp-constants.h. ! Keep in sync with include/gomp-constants.h.
integer (acc_device_kind), parameter :: acc_device_current = -3
integer (acc_device_kind), parameter :: acc_device_none = 0 integer (acc_device_kind), parameter :: acc_device_none = 0
integer (acc_device_kind), parameter :: acc_device_default = 1 integer (acc_device_kind), parameter :: acc_device_default = 1
integer (acc_device_kind), parameter :: acc_device_host = 2 integer (acc_device_kind), parameter :: acc_device_host = 2
...@@ -59,19 +60,19 @@ module openacc_internal ...@@ -59,19 +60,19 @@ module openacc_internal
implicit none implicit none
interface interface
function acc_on_device_h (d) function acc_on_device_h (devicetype)
import import
integer (acc_device_kind) d integer (acc_device_kind) devicetype
logical acc_on_device_h logical acc_on_device_h
end function end function
end interface end interface
interface interface
function acc_on_device_l (d) & function acc_on_device_l (devicetype) &
bind (C, name = "acc_on_device") bind (C, name = "acc_on_device")
use iso_c_binding, only: c_int use iso_c_binding, only: c_int
integer (c_int) :: acc_on_device_l integer (c_int) :: acc_on_device_l
integer (c_int), value :: d integer (c_int), value :: devicetype
end function end function
end interface end interface
end module openacc_internal end module openacc_internal
...@@ -96,14 +97,10 @@ module openacc ...@@ -96,14 +97,10 @@ module openacc
end module openacc end module openacc
function acc_on_device_h (d) function acc_on_device_h (devicetype)
use openacc_internal, only: acc_on_device_l use openacc_internal, only: acc_on_device_l
use openacc_kinds use openacc_kinds
integer (acc_device_kind) d integer (acc_device_kind) devicetype
logical acc_on_device_h logical acc_on_device_h
if (acc_on_device_l (d) .eq. 1) then acc_on_device_h = acc_on_device_l (devicetype) /= 0
acc_on_device_h = .TRUE.
else
acc_on_device_h = .FALSE.
end if
end function end function
...@@ -1818,14 +1818,12 @@ flag @option{-fopenacc} must be specified. This enables the OpenACC directive ...@@ -1818,14 +1818,12 @@ flag @option{-fopenacc} must be specified. This enables the OpenACC directive
arranges for automatic linking of the OpenACC runtime library arranges for automatic linking of the OpenACC runtime library
(@ref{OpenACC Runtime Library Routines}). (@ref{OpenACC Runtime Library Routines}).
See @uref{https://gcc.gnu.org/wiki/OpenACC} for more information.
A complete description of all OpenACC directives accepted may be found in A complete description of all OpenACC directives accepted may be found in
the @uref{https://www.openacc.org, OpenACC} Application Programming the @uref{https://www.openacc.org, OpenACC} Application Programming
Interface manual, version 2.6. Interface manual, version 2.6.
Note that this is an experimental feature and subject to
change in future versions of GCC. See
@uref{https://gcc.gnu.org/wiki/OpenACC} for more information.
@c --------------------------------------------------------------------- @c ---------------------------------------------------------------------
...@@ -1992,12 +1990,12 @@ parallel or kernels region. ...@@ -1992,12 +1990,12 @@ parallel or kernels region.
@table @asis @table @asis
@item @emph{Description} @item @emph{Description}
This function will indicate to the runtime which device number, This function will indicate to the runtime which device number,
specified by @var{num}, associated with the specified device specified by @var{devicenum}, associated with the specified device
type @var{devicetype}. type @var{devicetype}.
@item @emph{C/C++}: @item @emph{C/C++}:
@multitable @columnfractions .20 .80 @multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{acc_set_device_num(int num, acc_device_t devicetype);} @item @emph{Prototype}: @tab @code{acc_set_device_num(int devicenum, acc_device_t devicetype);}
@end multitable @end multitable
@item @emph{Fortran}: @item @emph{Fortran}:
...@@ -2055,6 +2053,14 @@ The Fortran @code{acc_get_property_string} subroutine returns the string ...@@ -2055,6 +2053,14 @@ The Fortran @code{acc_get_property_string} subroutine returns the string
retrieved in its fourth argument while the remaining entry points are retrieved in its fourth argument while the remaining entry points are
functions, which pass the return value as their result. functions, which pass the return value as their result.
Note for Fortran, only: the OpenACC technical committee corrected and, hence,
modified the interface introduced in OpenACC 2.6. The kind-value parameter
@code{acc_device_property} has been renamed to @code{acc_device_property_kind}
for consistency and the return type of the @code{acc_get_property} function is
now a @code{c_size_t} integer instead of a @code{acc_device_property} integer.
The parameter @code{acc_device_property} will continue to be provided,
but might be removed in a future version of GCC.
@item @emph{C/C++}: @item @emph{C/C++}:
@multitable @columnfractions .20 .80 @multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{size_t acc_get_property(int devicenum, acc_device_t devicetype, acc_device_property_t property);} @item @emph{Prototype}: @tab @code{size_t acc_get_property(int devicenum, acc_device_t devicetype, acc_device_property_t property);}
...@@ -2065,10 +2071,11 @@ functions, which pass the return value as their result. ...@@ -2065,10 +2071,11 @@ functions, which pass the return value as their result.
@multitable @columnfractions .20 .80 @multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{function acc_get_property(devicenum, devicetype, property)} @item @emph{Interface}: @tab @code{function acc_get_property(devicenum, devicetype, property)}
@item @emph{Interface}: @tab @code{subroutine acc_get_property_string(devicenum, devicetype, property, string)} @item @emph{Interface}: @tab @code{subroutine acc_get_property_string(devicenum, devicetype, property, string)}
@item @tab @code{use ISO_C_Binding, only: c_size_t}
@item @tab @code{integer devicenum} @item @tab @code{integer devicenum}
@item @tab @code{integer(kind=acc_device_kind) devicetype} @item @tab @code{integer(kind=acc_device_kind) devicetype}
@item @tab @code{integer(kind=acc_device_property) property} @item @tab @code{integer(kind=acc_device_property_kind) property}
@item @tab @code{integer(kind=acc_device_property) acc_get_property} @item @tab @code{integer(kind=c_size_t) acc_get_property}
@item @tab @code{character(*) string} @item @tab @code{character(*) string}
@end multitable @end multitable
...@@ -3331,8 +3338,8 @@ similarly to the first use case. ...@@ -3331,8 +3338,8 @@ similarly to the first use case.
There are two environment variables associated with the OpenACC library There are two environment variables associated with the OpenACC library
that may be used to control the device type and device number: that may be used to control the device type and device number:
@env{ACC_DEVICE_TYPE} and @env{ACC_DEVICE_NUM}, respecively. These two @env{ACC_DEVICE_TYPE} and @env{ACC_DEVICE_NUM}, respectively. These two
environement variables can be used as an alternative to calling environment variables can be used as an alternative to calling
@code{acc_set_device_num()}. As seen in the second use case, the device @code{acc_set_device_num()}. As seen in the second use case, the device
type and device number were specified using @code{acc_set_device_num()}. type and device number were specified using @code{acc_set_device_num()}.
If however, the aforementioned environment variables were set, then the If however, the aforementioned environment variables were set, then the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment