* [PATCH] OpenMP, Fortran: Bugfix for omp_set_num_teams.
@ 2022-03-15 17:05 Marcel Vollweiler
2022-03-15 17:28 ` Jakub Jelinek
0 siblings, 1 reply; 4+ messages in thread
From: Marcel Vollweiler @ 2022-03-15 17:05 UTC (permalink / raw)
To: gcc-patches, fortran
[-- Attachment #1: Type: text/plain, Size: 353 bytes --]
Hi,
This patch fixes a small bug for omp_set_num_teams in fortran.c.
Marcel
-----------------
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
[-- Attachment #2: omp-set-num-teams-bugfix.diff --]
[-- Type: text/plain, Size: 549 bytes --]
OpenMP, Fortran: Bugfix for omp_set_num_teams.
This patch fixes a small bug in the omp_set_num_teams implementation.
libgomp/ChangeLog:
* fortran.c (omp_set_num_teams_8_): Fix bug.
diff --git a/libgomp/fortran.c b/libgomp/fortran.c
index 8c1cfd1..d984ce5 100644
--- a/libgomp/fortran.c
+++ b/libgomp/fortran.c
@@ -491,7 +491,7 @@ omp_set_num_teams_ (const int32_t *num_teams)
void
omp_set_num_teams_8_ (const int64_t *num_teams)
{
- omp_set_max_active_levels (TO_INT (*num_teams));
+ omp_set_num_teams (TO_INT (*num_teams));
}
int32_t
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] OpenMP, Fortran: Bugfix for omp_set_num_teams.
2022-03-15 17:05 [PATCH] OpenMP, Fortran: Bugfix for omp_set_num_teams Marcel Vollweiler
@ 2022-03-15 17:28 ` Jakub Jelinek
2022-03-16 13:06 ` Marcel Vollweiler
0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2022-03-15 17:28 UTC (permalink / raw)
To: Marcel Vollweiler; +Cc: gcc-patches, fortran
On Tue, Mar 15, 2022 at 06:05:48PM +0100, Marcel Vollweiler wrote:
> Hi,
>
> This patch fixes a small bug for omp_set_num_teams in fortran.c.
>
> Marcel
> -----------------
> 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
> OpenMP, Fortran: Bugfix for omp_set_num_teams.
>
> This patch fixes a small bug in the omp_set_num_teams implementation.
>
> libgomp/ChangeLog:
>
> * fortran.c (omp_set_num_teams_8_): Fix bug.
Thanks for spotting this, but would be nice to cover it with
a testcase.
! { dg-do run }
! { dg-additional-options "-fdefault-integer-8" }
program set_num_teams_8
use omp_lib
omp_set_num_teams (42)
if (omp_get_num_teams () .ne. 42) stop 1
end program
or so would IMHO do it, please test that it FAILs without your fortran.c
fix and succeeds with it.
Ok for trunk with that change.
> diff --git a/libgomp/fortran.c b/libgomp/fortran.c
> index 8c1cfd1..d984ce5 100644
> --- a/libgomp/fortran.c
> +++ b/libgomp/fortran.c
> @@ -491,7 +491,7 @@ omp_set_num_teams_ (const int32_t *num_teams)
> void
> omp_set_num_teams_8_ (const int64_t *num_teams)
> {
> - omp_set_max_active_levels (TO_INT (*num_teams));
> + omp_set_num_teams (TO_INT (*num_teams));
> }
>
> int32_t
Jakub
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] OpenMP, Fortran: Bugfix for omp_set_num_teams.
2022-03-15 17:28 ` Jakub Jelinek
@ 2022-03-16 13:06 ` Marcel Vollweiler
2022-03-16 13:36 ` Jakub Jelinek
0 siblings, 1 reply; 4+ messages in thread
From: Marcel Vollweiler @ 2022-03-16 13:06 UTC (permalink / raw)
To: Jakub Jelinek, gcc-patches, fortran
[-- Attachment #1: Type: text/plain, Size: 851 bytes --]
Hi Jakub,
> ! { dg-do run }
> ! { dg-additional-options "-fdefault-integer-8" }
>
> program set_num_teams_8
> use omp_lib
> omp_set_num_teams (42)
> if (omp_get_num_teams () .ne. 42) stop 1
> end program
I modified your suggested test case a bit:
program set_num_teams_8
use omp_lib
use, intrinsic :: iso_fortran_env
integer(int64) :: x
x = 42
call omp_set_num_teams (x)
if (omp_get_max_teams () .ne. 42) stop 1
end program
I tested it with/without the fix and the test passed/failed as expected.
Hope, that's ok?
Marcel
-----------------
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
[-- Attachment #2: omp-set-num-teams-bugfix.diff --]
[-- Type: text/plain, Size: 1068 bytes --]
OpenMP, Fortran: Bugfix for omp_set_num_teams.
This patch fixes a small bug in the omp_set_num_teams implementation.
libgomp/ChangeLog:
* fortran.c (omp_set_num_teams_8_): Fix bug.
* testsuite/libgomp.fortran/icv-8.f90: New test.
diff --git a/libgomp/fortran.c b/libgomp/fortran.c
index 8c1cfd1..d984ce5 100644
--- a/libgomp/fortran.c
+++ b/libgomp/fortran.c
@@ -491,7 +491,7 @@ omp_set_num_teams_ (const int32_t *num_teams)
void
omp_set_num_teams_8_ (const int64_t *num_teams)
{
- omp_set_max_active_levels (TO_INT (*num_teams));
+ omp_set_num_teams (TO_INT (*num_teams));
}
int32_t
diff --git a/libgomp/testsuite/libgomp.fortran/icv-8.f90 b/libgomp/testsuite/libgomp.fortran/icv-8.f90
new file mode 100644
index 0000000..9478c15
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/icv-8.f90
@@ -0,0 +1,10 @@
+! This tests 'set_num_teams_8' function.
+
+program set_num_teams_8
+ use omp_lib
+ use, intrinsic :: iso_fortran_env
+ integer(int64) :: x
+ x = 42
+ call omp_set_num_teams (x)
+ if (omp_get_max_teams () .ne. 42) stop 1
+end program
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] OpenMP, Fortran: Bugfix for omp_set_num_teams.
2022-03-16 13:06 ` Marcel Vollweiler
@ 2022-03-16 13:36 ` Jakub Jelinek
0 siblings, 0 replies; 4+ messages in thread
From: Jakub Jelinek @ 2022-03-16 13:36 UTC (permalink / raw)
To: Marcel Vollweiler; +Cc: gcc-patches, fortran
On Wed, Mar 16, 2022 at 02:06:16PM +0100, Marcel Vollweiler wrote:
> libgomp/ChangeLog:
>
> * fortran.c (omp_set_num_teams_8_): Fix bug.
> * testsuite/libgomp.fortran/icv-8.f90: New test.
Ok, with a minor nit. Please use
Call omp_set_num_teams instead of omp_set_max_active_levels.
instead of
Fix bug.
in the ChangeLog.
> diff --git a/libgomp/fortran.c b/libgomp/fortran.c
> index 8c1cfd1..d984ce5 100644
> --- a/libgomp/fortran.c
> +++ b/libgomp/fortran.c
> @@ -491,7 +491,7 @@ omp_set_num_teams_ (const int32_t *num_teams)
> void
> omp_set_num_teams_8_ (const int64_t *num_teams)
> {
> - omp_set_max_active_levels (TO_INT (*num_teams));
> + omp_set_num_teams (TO_INT (*num_teams));
> }
>
> int32_t
> diff --git a/libgomp/testsuite/libgomp.fortran/icv-8.f90 b/libgomp/testsuite/libgomp.fortran/icv-8.f90
> new file mode 100644
> index 0000000..9478c15
> --- /dev/null
> +++ b/libgomp/testsuite/libgomp.fortran/icv-8.f90
> @@ -0,0 +1,10 @@
> +! This tests 'set_num_teams_8' function.
> +
> +program set_num_teams_8
> + use omp_lib
> + use, intrinsic :: iso_fortran_env
> + integer(int64) :: x
> + x = 42
> + call omp_set_num_teams (x)
> + if (omp_get_max_teams () .ne. 42) stop 1
> +end program
Jakub
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-03-16 13:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-15 17:05 [PATCH] OpenMP, Fortran: Bugfix for omp_set_num_teams Marcel Vollweiler
2022-03-15 17:28 ` Jakub Jelinek
2022-03-16 13:06 ` Marcel Vollweiler
2022-03-16 13:36 ` Jakub Jelinek
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).