Sems like a compiler bug. Your example code works with the compiler I tried.
Two basic concepts:
1) An image selector that selects the local image has the same effect as not specifying an image selector at all (assuming a coindexed object is allowed in that context). So, [this_image()] is somewhat pointless in practice.
2) The main usage assumption for the atomic subroutines is that the ATOM argument will be coindexed. (The argument is required to be a coarray, but the conidexing is not required.)
The intended usage of the atomic subroutines is to perform an atomic operation on a variable residing on a different image. The fact that you have selected your own image in the [ ] is just a special case. Which is intended to work.
Cheers,
Bill
> On Nov 28, 2017, at 9:36 AM, Vipul Parekh <[log in to unmask]> wrote:
>
> Is the following code standard-conforming? A processor I tried
> compiles the code alright however it encounters a run-time exception
> with access violation during the ATOMIC_REF instruction on coarray
> image 1.
>
> --- begin snippet ---
> use, intrinsic :: iso_fortran_env, only : atomic_int_kind
>
> type :: t
> integer(kind=atomic_int_kind) :: i
> end type
>
> integer(kind=atomic_int_kind) :: vali
> type(t), save :: foo[*]
>
> if ( this_image() == 1 ) then
>
> call atomic_define( atom=foo[ this_image() ]%i, value=42 )
>
> sync memory
>
> call atomic_ref( value=vali, atom=foo[ this_image() ]%i )
>
> end if
>
> end
> --- end snippet ---
>
> Thanks,
> Vipul Parekh
Bill Long [log in to unmask]
Principal Engineer, Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9143
Cray Inc./ 2131 Lindau Lane/ Suite 1000/ Bloomington, MN 55425
|