On Tue, Jul 27, 2021 at 04:26:22PM +0200, Ulrich Drepper via Gcc-patches wrote:
> I know OpenMP 5.1 is not really a focus yet but adding this new interface
> should not be problematic.  I stumbled across this part of the spec and the
> functionality is really already mostly there in the form of
> OMP_DISPLAY_ENV=verbose etc.  This is just a function interface to the same
> functionality.
> 
> Aside from the busywork to add a new interface (headers, map file) the only
> real question was how to deal with the two parameters which are passed
> to handle_omp_display_env in the current implementation. The
> omp_display_env interface is supposed to show the information of the
> initial values and therefore I think the right implementation is to store
> the values determined in the constructor in two global, static variables
> and reuse them.
> 
> The rest should be completely boring and therefore not distracting anyone
> from OpenMP 5.0 work.

Thanks.
You'll need to write a ChangeLog entry and put it at the end of the commit
message, otherwise pre-commit hooks will reject the commit.

--- a/libgomp/env.c
+++ b/libgomp/env.c
@@ -1210,46 +1213,11 @@ parse_gomp_openacc_dim (void)
     }
 }

-static void
-handle_omp_display_env (unsigned long stacksize, int wait_policy)
+void
+omp_display_env (int verbose)

Please add
ialias (omp_display_env)
right after the function definition, we don't want to introduce new
PLT slots unnecessarily and omp_display_env is an exported function.

> --- a/libgomp/fortran.c
> +++ b/libgomp/fortran.c

And ialias_redirect (omp_display_env) here.

> @@ -736,3 +736,9 @@ omp_get_default_allocator_ ()
>  {
>    return (intptr_t) omp_get_default_allocator ();
>  }
> +
> +void
> +omp_display_env_ (const int32_t *verbose)
> +{
> +  omp_display_env (*verbose);
> +}

For Fortran functions/subroutines that take integer arguments
libgomp typically defines two functions, one with _ suffix
and one with _8_ suffix, the former taking const int32_t *
and the latter const int64_t * and using !! for logicals
and TO_INT macro for integers.
Please grep e.g. for omp_set_dynamic in
fortran.c, libgomp.map and omp_lib.f90.in.
This is needed to make calls to those functions work even with
-fdefault-integer-8

> --- a/libgomp/omp_lib.f90.in
> +++ b/libgomp/omp_lib.f90.in
> @@ -653,6 +653,12 @@
>            end function
>          end interface
> 
> +        interface
> +          subroutine omp_display_env (verbose)
> +            logical,intent(in) :: verbose
> +          end subroutine
> +        end interface

See above.  Plus, please add space between comma and intent(in).

Otherwise LGTM.

        Jakub

Reply via email to