On Tue, Jul 14, 2020 at 09:15:21AM +0200, Tobias Burnus wrote: > libgomp/ChangeLog: > > * allocator.c: Add ialias for omp_init_allocator and > omp_destroy_allocator. > * configure.ac: Set INTPTR_T_KIND. > * configure: Regenerate. > * Makefile.in: Regenerate. > * testsuite/Makefile.in: Regenerate. > * fortran.c (omp_init_allocator_, omp_destroy_allocator_, > omp_set_default_allocator_, omp_get_default_allocator_): New > functions and ialias_redirect. > * icv.c: Add ialias for omp_set_default_allocator and > omp_get_default_allocator. > * libgomp.map (OMP_5.0.1): Add omp_init_allocator_, > omp_destroy_allocator_, omp_set_default_allocator_ and > omp_get_default_allocator_. > * omp_lib.f90.in: Add allocator traits parameters, declare > allocator routines and add related kind parameters. > * omp_lib.h.in: Likewise. > * testsuite/libgomp.c-c++-common/alloc-2.c: Fix sizeof. > * testsuite/libgomp.fortran/alloc-1.f90: New test. > * testsuite/libgomp.fortran/alloc-2.f90: New test. > * testsuite/libgomp.fortran/alloc-3.f90: New test.
> --- a/libgomp/fortran.c > +++ b/libgomp/fortran.c > @@ -86,6 +86,10 @@ ialias_redirect (omp_get_initial_device) > ialias_redirect (omp_get_max_task_priority) > ialias_redirect (omp_pause_resource) > ialias_redirect (omp_pause_resource_all) > +ialias_redirect (omp_destroy_allocator) > +ialias_redirect (omp_destroy_allocator) The first one should be omp_init_allocator, shouldn't it? > +ialias_redirect (omp_set_default_allocator) > +ialias_redirect (omp_get_default_allocator) > #endif > > #ifndef LIBGOMP_GNU_SYMBOL_VERSIONING > diff --git a/libgomp/omp_lib.f90.in b/libgomp/omp_lib.f90.in > index fdbc0f4657d..0c9eba39d72 100644 > --- a/libgomp/omp_lib.f90.in > +++ b/libgomp/omp_lib.f90.in > @@ -24,13 +24,19 @@ > ! <http://www.gnu.org/licenses/>. > > module omp_lib_kinds > + use iso_c_binding, only: c_intptr_t > implicit none > + private :: c_intptr_t > integer, parameter :: omp_lock_kind = @OMP_LOCK_KIND@ > integer, parameter :: omp_nest_lock_kind = @OMP_NEST_LOCK_KIND@ > integer, parameter :: omp_sched_kind = 4 > integer, parameter :: omp_proc_bind_kind = 4 > integer, parameter :: omp_lock_hint_kind = 4 > integer, parameter :: omp_pause_resource_kind = 4 > + integer, parameter :: omp_allocator_handle_kind = c_intptr_t > + integer, parameter :: omp_alloctrait_key_kind = c_int Is c_int a keyword? Because you use only c_intptr_t from iso_c_binding... > + integer, parameter :: omp_alloctrait_val_kind = c_intptr_t > + integer, parameter :: omp_memspace_handle_kind = c_intptr_t > + integer (kind=omp_alloctrait_val_kind), & > + parameter :: omp_atv_false = 0 > + integer (kind=omp_alloctrait_val_kind), & > + parameter :: omp_atv_true = 1 > + integer (kind=omp_alloctrait_val_kind), & > + parameter :: omp_atv_default = 2 Please follow the recent (sure, again 5.1-ish) changes, namely that omp_atv_default is -1 (and should be defined probably before omp_atv_false) and > + integer (kind=omp_alloctrait_val_kind), & > + parameter :: omp_atv_contended = 3 > + integer (kind=omp_alloctrait_val_kind), & > + parameter :: omp_atv_uncontended = 4 > + integer (kind=omp_alloctrait_val_kind), & > + parameter :: omp_atv_sequential = 5 integer (kind=omp_alloctrait_val_kind), & parameter :: omp_atv_serialized = 5 integer (kind=omp_alloctrait_val_kind), & parameter :: omp_atv_sequantial = omp_atv_serialized > + interface > + function omp_init_allocator (memspace, ntraits, traits) > + use omp_lib_kinds > + integer (kind=omp_allocator_handle_kind) omp_init_allocator > + integer (kind=omp_memspace_handle_kind), & > + intent(in) :: memspace > + integer, intent(in) :: ntraits > + type (omp_alloctrait), intent(in) :: traits(*) > + end function Do we want to have 2 versions of this for different -fdefault-initeger-* ? I mean like we have: subroutine omp_set_num_threads (num_threads) integer (4), intent (in) :: num_threads end subroutine omp_set_num_threads subroutine omp_set_num_threads_8 (num_threads) integer (8), intent (in) :: num_threads end subroutine omp_set_num_threads_8 have omp_init_allocator_ use integer (kind=4) ntraits, and omp_init_allocator_8_ use integer (kind=8) ntraits? > + interface > + subroutine omp_set_default_allocator (allocator) > + use omp_lib_kinds > + integer (kind=omp_allocator_handle_kind), & > + intent(in) :: allocator > + end subroutine > + end interface > + > + interface > + function omp_get_default_allocator () > + use omp_lib_kinds > + integer(kind=omp_allocator_handle_kind) & Inconstistency, earlier you use "integer (kind=" but here without space. > + parameter (omp_atv_default = 2) > + parameter (omp_atv_sequential = 5) See above. > + type omp_alloctrait > + integer (omp_alloctrait_key_kind) key > + integer (omp_alloctrait_val_kind) value > + end type omp_alloctrait I know this is a problem in the standard, but won't gfortran in some strict F77 conformance mode if it has any diagnose this? If not, fine, if yes, do we want some extension that it will accept the derived type quietly? > --- a/libgomp/testsuite/libgomp.c-c++-common/alloc-2.c > +++ b/libgomp/testsuite/libgomp.c-c++-common/alloc-2.c > @@ -23,7 +23,7 @@ main () > if (p == NULL) > abort (); > p[0] = 1.0; > - p[1695 / sizeof (double *)] = 2.0; > + p[1695 / sizeof (double)] = 2.0; Oops, good catch. Embarrassed. Jakub