Hi Jakub,
On 21.02.22 18:47, Jakub Jelinek wrote:
Where ME is involved is
!$omp requires atomic_default_mem_order(whatever) vs.
!$omp declare variant ...atomic_default_mem_order(whatever).
Ups, missed that case. (Also because there wasn't 'declare variant' when
implementing 'requires' in Fortran.)
Disclaimer to all of the following remarks: I do not understand context
selectors and their fineprint. Thus, my comments my be completely off:
subroutine baz
...
interface
subroutine bar
end subroutine
!$omp declare variant (foo) &
!$omp & match (implementation={atomic_default_mem_order(seq_cst)})
end interface
call bar
end subroutine baz
I concur that in this case, it needs to know the 'atomic_default_mem_order'
of baz. — But that seems to be not implementable using a module as
module m_foo
!$omp requires atomic_default_mem_order(...)
contains
subroutine foo
...
end
end module m_bar
...
subroutine baz
use m_foo, only: foo
...
end
seems to make the 'requires' available - such that it cannot be overridden
via a local 'require atomic_default_mem_order'. And having a 'use m_bar'
then has conflicting declarations. Similar probably with C++ modules,
unless the 'requires' does not propagate. (Does it?)
I find it odd to have only code which works when not using modules.
(Explicitly using the mem_order on 'omp atomic' still works.)
And for the other requires in context selectors, I do not really understand how
they
are supposed to get used, either. If any 'unified_shared_memory' or
'dynamic_allocators'
appears (in linked-in code), it is in principle callable – the the run-time
library
should then remove all devices which do not support it, possibly only keeping
the
host device; for USM, it even has to be present in all compilation units. Thus,
just
directly calling the dynamic_allocators/unified_shared_memory should have the
same
effect at the end, shouldn't it?
Tobias
-----------------
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