* Add 'libgomp.{,oacc-}fortran/fortran-torture_execute_math.f90'
@ 2023-06-05 12:18 Thomas Schwinge
2023-06-13 10:42 ` [ping] " Thomas Schwinge
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Schwinge @ 2023-06-05 12:18 UTC (permalink / raw)
To: fortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 395 bytes --]
Hi!
OK to push the attached
"Add 'libgomp.{,oacc-}fortran/fortran-torture_execute_math.f90'"?
Grüße
Thomas
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-libgomp.-oacc-fortran-fortran-torture_execute_ma.patch --]
[-- Type: text/x-diff, Size: 3616 bytes --]
From 0d5095d8cd2d68113890a39a7fdb649198e576c1 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Fri, 2 Jun 2023 23:11:00 +0200
Subject: [PATCH] Add
'libgomp.{,oacc-}fortran/fortran-torture_execute_math.f90'
gcc/testsuite/
* gfortran.fortran-torture/execute/math.f90: Enhance for optional
OpenACC, OpenMP 'target' usage.
libgomp/
* testsuite/libgomp.fortran/fortran-torture_execute_math.f90: New.
* testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90:
Likewise.
---
.../gfortran.fortran-torture/execute/math.f90 | 23 +++++++++++++++++--
.../fortran-torture_execute_math.f90 | 4 ++++
.../fortran-torture_execute_math.f90 | 5 ++++
3 files changed, 30 insertions(+), 2 deletions(-)
create mode 100644 libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90
create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90
diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/math.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/math.f90
index 17cc78f7a10..e71f669304f 100644
--- a/gcc/testsuite/gfortran.fortran-torture/execute/math.f90
+++ b/gcc/testsuite/gfortran.fortran-torture/execute/math.f90
@@ -1,9 +1,14 @@
! Program to test mathematical intrinsics
+
+! See also 'libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90'; thus the '!$omp' directives.
+! See also 'libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90'; thus the '!$acc' directives.
+
subroutine dotest (n, val4, val8, known)
implicit none
real(kind=4) val4, known
real(kind=8) val8
integer n
+ !$acc routine seq
if (abs (val4 - known) .gt. 0.001) STOP 1
if (abs (real (val8, kind=4) - known) .gt. 0.001) STOP 2
@@ -14,17 +19,20 @@ subroutine dotestc (n, val4, val8, known)
complex(kind=4) val4, known
complex(kind=8) val8
integer n
+ !$acc routine seq
+
if (abs (val4 - known) .gt. 0.001) STOP 3
if (abs (cmplx (val8, kind=4) - known) .gt. 0.001) STOP 4
end subroutine
-program testmath
+subroutine testmath
implicit none
real(kind=4) r, two4, half4
real(kind=8) q, two8, half8
complex(kind=4) cr
complex(kind=8) cq
external dotest, dotestc
+ !$acc routine seq
two4 = 2.0
two8 = 2.0_8
@@ -96,5 +104,16 @@ program testmath
cq = log ((-1.0_8, -1.0_8))
call dotestc (21, cr, cq, (0.3466, -2.3562))
-end program
+end subroutine
+program main
+ implicit none
+ external testmath
+
+ !$acc serial
+ !$omp target
+ call testmath
+ !$acc end serial
+ !$omp end target
+
+end program
diff --git a/libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90 b/libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90
new file mode 100644
index 00000000000..3348a0bb3ad
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90
@@ -0,0 +1,4 @@
+! { dg-do run }
+! { dg-additional-options -foffload-options=-lm }
+
+include '../../../gcc/testsuite/gfortran.fortran-torture/execute/math.f90'
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90 b/libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90
new file mode 100644
index 00000000000..1b2ac440762
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90
@@ -0,0 +1,5 @@
+! { dg-do run }
+!TODO { dg-prune-output {using 'vector_length \(32\)', ignoring 1} }
+! { dg-additional-options -foffload-options=-lm }
+
+include '../../../gcc/testsuite/gfortran.fortran-torture/execute/math.f90'
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ping] Add 'libgomp.{,oacc-}fortran/fortran-torture_execute_math.f90'
2023-06-05 12:18 Add 'libgomp.{,oacc-}fortran/fortran-torture_execute_math.f90' Thomas Schwinge
@ 2023-06-13 10:42 ` Thomas Schwinge
2023-06-13 11:11 ` Tobias Burnus
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Schwinge @ 2023-06-13 10:42 UTC (permalink / raw)
To: fortran, gcc-patches, Jakub Jelinek, Tobias Burnus
[-- Attachment #1: Type: text/plain, Size: 447 bytes --]
Hi!
On 2023-06-05T14:18:48+0200, I wrote:
> OK to push the attached
> "Add 'libgomp.{,oacc-}fortran/fortran-torture_execute_math.f90'"?
Ping.
Grüße
Thomas
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-libgomp.-oacc-fortran-fortran-torture_execute_ma.patch --]
[-- Type: text/x-diff, Size: 3616 bytes --]
From 0d5095d8cd2d68113890a39a7fdb649198e576c1 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Fri, 2 Jun 2023 23:11:00 +0200
Subject: [PATCH] Add
'libgomp.{,oacc-}fortran/fortran-torture_execute_math.f90'
gcc/testsuite/
* gfortran.fortran-torture/execute/math.f90: Enhance for optional
OpenACC, OpenMP 'target' usage.
libgomp/
* testsuite/libgomp.fortran/fortran-torture_execute_math.f90: New.
* testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90:
Likewise.
---
.../gfortran.fortran-torture/execute/math.f90 | 23 +++++++++++++++++--
.../fortran-torture_execute_math.f90 | 4 ++++
.../fortran-torture_execute_math.f90 | 5 ++++
3 files changed, 30 insertions(+), 2 deletions(-)
create mode 100644 libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90
create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90
diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/math.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/math.f90
index 17cc78f7a10..e71f669304f 100644
--- a/gcc/testsuite/gfortran.fortran-torture/execute/math.f90
+++ b/gcc/testsuite/gfortran.fortran-torture/execute/math.f90
@@ -1,9 +1,14 @@
! Program to test mathematical intrinsics
+
+! See also 'libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90'; thus the '!$omp' directives.
+! See also 'libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90'; thus the '!$acc' directives.
+
subroutine dotest (n, val4, val8, known)
implicit none
real(kind=4) val4, known
real(kind=8) val8
integer n
+ !$acc routine seq
if (abs (val4 - known) .gt. 0.001) STOP 1
if (abs (real (val8, kind=4) - known) .gt. 0.001) STOP 2
@@ -14,17 +19,20 @@ subroutine dotestc (n, val4, val8, known)
complex(kind=4) val4, known
complex(kind=8) val8
integer n
+ !$acc routine seq
+
if (abs (val4 - known) .gt. 0.001) STOP 3
if (abs (cmplx (val8, kind=4) - known) .gt. 0.001) STOP 4
end subroutine
-program testmath
+subroutine testmath
implicit none
real(kind=4) r, two4, half4
real(kind=8) q, two8, half8
complex(kind=4) cr
complex(kind=8) cq
external dotest, dotestc
+ !$acc routine seq
two4 = 2.0
two8 = 2.0_8
@@ -96,5 +104,16 @@ program testmath
cq = log ((-1.0_8, -1.0_8))
call dotestc (21, cr, cq, (0.3466, -2.3562))
-end program
+end subroutine
+program main
+ implicit none
+ external testmath
+
+ !$acc serial
+ !$omp target
+ call testmath
+ !$acc end serial
+ !$omp end target
+
+end program
diff --git a/libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90 b/libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90
new file mode 100644
index 00000000000..3348a0bb3ad
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90
@@ -0,0 +1,4 @@
+! { dg-do run }
+! { dg-additional-options -foffload-options=-lm }
+
+include '../../../gcc/testsuite/gfortran.fortran-torture/execute/math.f90'
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90 b/libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90
new file mode 100644
index 00000000000..1b2ac440762
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90
@@ -0,0 +1,5 @@
+! { dg-do run }
+!TODO { dg-prune-output {using 'vector_length \(32\)', ignoring 1} }
+! { dg-additional-options -foffload-options=-lm }
+
+include '../../../gcc/testsuite/gfortran.fortran-torture/execute/math.f90'
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [ping] Add 'libgomp.{,oacc-}fortran/fortran-torture_execute_math.f90'
2023-06-13 10:42 ` [ping] " Thomas Schwinge
@ 2023-06-13 11:11 ` Tobias Burnus
2023-06-14 9:56 ` Thomas Schwinge
0 siblings, 1 reply; 4+ messages in thread
From: Tobias Burnus @ 2023-06-13 11:11 UTC (permalink / raw)
To: Thomas Schwinge, fortran, gcc-patches, Jakub Jelinek
On 13.06.23 12:42, Thomas Schwinge wrote:
> On 2023-06-05T14:18:48+0200, I wrote:
>> OK to push the attached
>> "Add 'libgomp.{,oacc-}fortran/fortran-torture_execute_math.f90'"?
>
> Subject: [PATCH] Add
> 'libgomp.{,oacc-}fortran/fortran-torture_execute_math.f90'
>
> gcc/testsuite/
> * gfortran.fortran-torture/execute/math.f90: Enhance for optional
> OpenACC, OpenMP 'target' usage.
I think it is more readable with a linebreak here and with "OpenACC
'serial' and OpenMP ..." instead of "OpenACC, OpenMP".
What I would like to see a hint somewhere in the commit log that the
libgomp files include the gfortran.fortran-torture file. I don't care
whether you add the hint before the changelog items as free text – or in
the bullet above (e.g. "as it is included in libgomp/testsuite") – or
after "New." in the following bullet list.
> libgomp/
> * testsuite/libgomp.fortran/fortran-torture_execute_math.f90: New.
> * testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90:
> Likewise.
> ---
> .../gfortran.fortran-torture/execute/math.f90 | 23 +++++++++++++++++--
> .../fortran-torture_execute_math.f90 | 4 ++++
> .../fortran-torture_execute_math.f90 | 5 ++++
> 3 files changed, 30 insertions(+), 2 deletions(-)
> create mode 100644 libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90
> create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90
>
> diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/math.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/math.f90
> index 17cc78f7a10..e71f669304f 100644
> --- a/gcc/testsuite/gfortran.fortran-torture/execute/math.f90
> +++ b/gcc/testsuite/gfortran.fortran-torture/execute/math.f90
> @@ -1,9 +1,14 @@
> ! Program to test mathematical intrinsics
> +
> +! See also 'libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90'; thus the '!$omp' directives.
> +! See also 'libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90'; thus the '!$acc' directives.
Likewise here: it is not completely obvious that this file is 'include'd
by the other testcases.
Maybe add a line "! This file is also included in:" and remove the "See
also" or some creative variant of it.
Minor remark: The OpenMP part is OK, but strict reading of the spec
requires an "omp declare target' if a subroutine is in a different
compilation unit. And according the glossary, that's the case here. In
practice, it also works without as it is in the same translation unit.
(compilation unit = for C/C++: translation unit, for Fortran:
subprogram). I think the HPE/Cray compiler will complain, but maybe only
when used with modules and not with subroutine subprograms. (As many
compilers write a .mod file for modules, a late change of attributes can
be more problematic.)
Otherwise LGTM.
Tobias
PS: I assume that you have check it with both with an in-build-tree and
an in-install-tree testsuite run.
> +
> subroutine dotest (n, val4, val8, known)
> implicit none
> real(kind=4) val4, known
> real(kind=8) val8
> integer n
> + !$acc routine seq
>
> if (abs (val4 - known) .gt. 0.001) STOP 1
> if (abs (real (val8, kind=4) - known) .gt. 0.001) STOP 2
> @@ -14,17 +19,20 @@ subroutine dotestc (n, val4, val8, known)
> complex(kind=4) val4, known
> complex(kind=8) val8
> integer n
> + !$acc routine seq
> +
> if (abs (val4 - known) .gt. 0.001) STOP 3
> if (abs (cmplx (val8, kind=4) - known) .gt. 0.001) STOP 4
> end subroutine
>
> -program testmath
> +subroutine testmath
> implicit none
> real(kind=4) r, two4, half4
> real(kind=8) q, two8, half8
> complex(kind=4) cr
> complex(kind=8) cq
> external dotest, dotestc
> + !$acc routine seq
>
> two4 = 2.0
> two8 = 2.0_8
> @@ -96,5 +104,16 @@ program testmath
> cq = log ((-1.0_8, -1.0_8))
> call dotestc (21, cr, cq, (0.3466, -2.3562))
>
> -end program
> +end subroutine
>
> +program main
> + implicit none
> + external testmath
> +
> + !$acc serial
> + !$omp target
> + call testmath
> + !$acc end serial
> + !$omp end target
> +
> +end program
> diff --git a/libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90 b/libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90
> new file mode 100644
> index 00000000000..3348a0bb3ad
> --- /dev/null
> +++ b/libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90
> @@ -0,0 +1,4 @@
> +! { dg-do run }
> +! { dg-additional-options -foffload-options=-lm }
> +
> +include '../../../gcc/testsuite/gfortran.fortran-torture/execute/math.f90'
> diff --git a/libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90 b/libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90
> new file mode 100644
> index 00000000000..1b2ac440762
> --- /dev/null
> +++ b/libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90
> @@ -0,0 +1,5 @@
> +! { dg-do run }
> +!TODO { dg-prune-output {using 'vector_length \(32\)', ignoring 1} }
> +! { dg-additional-options -foffload-options=-lm }
> +
> +include '../../../gcc/testsuite/gfortran.fortran-torture/execute/math.f90'
> -- 2.34.1
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
^ permalink raw reply [flat|nested] 4+ messages in thread
* Add 'libgomp.{,oacc-}fortran/fortran-torture_execute_math.f90'
2023-06-13 11:11 ` Tobias Burnus
@ 2023-06-14 9:56 ` Thomas Schwinge
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Schwinge @ 2023-06-14 9:56 UTC (permalink / raw)
To: Tobias Burnus, gcc-patches; +Cc: Jakub Jelinek, fortran
[-- Attachment #1: Type: text/plain, Size: 3784 bytes --]
Hi!
On 2023-06-13T13:11:38+0200, Tobias Burnus <tobias@codesourcery.com> wrote:
> On 13.06.23 12:42, Thomas Schwinge wrote:
>> On 2023-06-05T14:18:48+0200, I wrote:
>>> OK to push the attached
>>> "Add 'libgomp.{,oacc-}fortran/fortran-torture_execute_math.f90'"?
>>
>> Subject: [PATCH] Add
>> 'libgomp.{,oacc-}fortran/fortran-torture_execute_math.f90'
>>
>> gcc/testsuite/
>> * gfortran.fortran-torture/execute/math.f90: Enhance for optional
>> OpenACC, OpenMP 'target' usage.
>
> I think it is more readable with a linebreak here and with "OpenACC
> 'serial' and OpenMP ..." instead of "OpenACC, OpenMP".
>
> What I would like to see a hint somewhere in the commit log that the
> libgomp files include the gfortran.fortran-torture file. I don't care
> whether you add the hint before the changelog items as free text – or in
> the bullet above (e.g. "as it is included in libgomp/testsuite") – or
> after "New." in the following bullet list.
>
>> libgomp/
>> * testsuite/libgomp.fortran/fortran-torture_execute_math.f90: New.
>> * testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90:
>> Likewise.
>
>> ---
>> .../gfortran.fortran-torture/execute/math.f90 | 23 +++++++++++++++++--
>> .../fortran-torture_execute_math.f90 | 4 ++++
>> .../fortran-torture_execute_math.f90 | 5 ++++
>> 3 files changed, 30 insertions(+), 2 deletions(-)
>> create mode 100644 libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90
>> create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90
>>
>> diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/math.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/math.f90
>> index 17cc78f7a10..e71f669304f 100644
>> --- a/gcc/testsuite/gfortran.fortran-torture/execute/math.f90
>> +++ b/gcc/testsuite/gfortran.fortran-torture/execute/math.f90
>> @@ -1,9 +1,14 @@
>> ! Program to test mathematical intrinsics
>> +
>> +! See also 'libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90'; thus the '!$omp' directives.
>> +! See also 'libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90'; thus the '!$acc' directives.
>
> Likewise here: it is not completely obvious that this file is 'include'd
> by the other testcases.
>
> Maybe add a line "! This file is also included in:" and remove the "See
> also" or some creative variant of it.
>
> Minor remark: The OpenMP part is OK, but strict reading of the spec
> requires an "omp declare target' if a subroutine is in a different
> compilation unit. And according the glossary, that's the case here. In
> practice, it also works without as it is in the same translation unit.
> (compilation unit = for C/C++: translation unit, for Fortran:
> subprogram). I think the HPE/Cray compiler will complain, but maybe only
> when used with modules and not with subroutine subprograms. (As many
> compilers write a .mod file for modules, a late change of attributes can
> be more problematic.)
>
> Otherwise LGTM.
Thanks for the review. I've now pushed
commit e76af2162c7b768ef0a913d485c51a80b08a1020
"Add 'libgomp.{,oacc-}fortran/fortran-torture_execute_math.f90'", see
attached.
> PS: I assume that you have check it with both with an in-build-tree and
> an in-install-tree testsuite run.
I happened to have (..., but don't think it'd make a relevant difference
here?)
Grüße
Thomas
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-libgomp.-oacc-fortran-fortran-torture_execute_ma.patch --]
[-- Type: text/x-diff, Size: 3820 bytes --]
From e76af2162c7b768ef0a913d485c51a80b08a1020 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Fri, 2 Jun 2023 23:11:00 +0200
Subject: [PATCH] Add
'libgomp.{,oacc-}fortran/fortran-torture_execute_math.f90'
..., via 'include'ing the existing 'gfortran.fortran-torture/execute/math.f90',
which therefore is enhanced for optional OpenACC 'serial', OpenMP 'target'
usage.
gcc/testsuite/
* gfortran.fortran-torture/execute/math.f90: Enhance for optional
OpenACC 'serial', OpenMP 'target' usage.
libgomp/
* testsuite/libgomp.fortran/fortran-torture_execute_math.f90: New.
* testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90:
Likewise.
---
.../gfortran.fortran-torture/execute/math.f90 | 24 +++++++++++++++++--
.../fortran-torture_execute_math.f90 | 4 ++++
.../fortran-torture_execute_math.f90 | 5 ++++
3 files changed, 31 insertions(+), 2 deletions(-)
create mode 100644 libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90
create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90
diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/math.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/math.f90
index 17cc78f7a105..6c97eba3f8ff 100644
--- a/gcc/testsuite/gfortran.fortran-torture/execute/math.f90
+++ b/gcc/testsuite/gfortran.fortran-torture/execute/math.f90
@@ -1,9 +1,15 @@
! Program to test mathematical intrinsics
+
+! This file is also 'include'd in:
+! - 'libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90' (thus the '!$omp' directives)
+! - 'libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90' (thus the '!$acc' directives)
+
subroutine dotest (n, val4, val8, known)
implicit none
real(kind=4) val4, known
real(kind=8) val8
integer n
+ !$acc routine seq
if (abs (val4 - known) .gt. 0.001) STOP 1
if (abs (real (val8, kind=4) - known) .gt. 0.001) STOP 2
@@ -14,17 +20,20 @@ subroutine dotestc (n, val4, val8, known)
complex(kind=4) val4, known
complex(kind=8) val8
integer n
+ !$acc routine seq
+
if (abs (val4 - known) .gt. 0.001) STOP 3
if (abs (cmplx (val8, kind=4) - known) .gt. 0.001) STOP 4
end subroutine
-program testmath
+subroutine testmath
implicit none
real(kind=4) r, two4, half4
real(kind=8) q, two8, half8
complex(kind=4) cr
complex(kind=8) cq
external dotest, dotestc
+ !$acc routine seq
two4 = 2.0
two8 = 2.0_8
@@ -96,5 +105,16 @@ program testmath
cq = log ((-1.0_8, -1.0_8))
call dotestc (21, cr, cq, (0.3466, -2.3562))
-end program
+end subroutine
+program main
+ implicit none
+ external testmath
+
+ !$acc serial
+ !$omp target
+ call testmath
+ !$acc end serial
+ !$omp end target
+
+end program
diff --git a/libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90 b/libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90
new file mode 100644
index 000000000000..3348a0bb3adc
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90
@@ -0,0 +1,4 @@
+! { dg-do run }
+! { dg-additional-options -foffload-options=-lm }
+
+include '../../../gcc/testsuite/gfortran.fortran-torture/execute/math.f90'
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90 b/libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90
new file mode 100644
index 000000000000..1b2ac4407623
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90
@@ -0,0 +1,5 @@
+! { dg-do run }
+!TODO { dg-prune-output {using 'vector_length \(32\)', ignoring 1} }
+! { dg-additional-options -foffload-options=-lm }
+
+include '../../../gcc/testsuite/gfortran.fortran-torture/execute/math.f90'
--
2.39.2
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-06-14 9:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-05 12:18 Add 'libgomp.{,oacc-}fortran/fortran-torture_execute_math.f90' Thomas Schwinge
2023-06-13 10:42 ` [ping] " Thomas Schwinge
2023-06-13 11:11 ` Tobias Burnus
2023-06-14 9:56 ` Thomas Schwinge
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).