• Does an event-variable have to be a coarray?

    From Thomas Koenig@21:1/5 to All on Fri Feb 25 07:19:02 2022
    Just looking through J3/18-007r1 ...

    11.6.7 says

    R1171 event-variable is scalar-variable

    C1176 (R1171) An event-variable shall be of type EVENT_TYPE from
    the intrinsic module ISO_FORTRAN- ENV (16.10.2).

    Clear so far.

    11.6.8 tells me

    C1177 (R1172) The event-variable in an event-wait-stmt shall not
    be coindexed.

    and

    The event-variable shall not depend on the value of stat-variable
    or errmsg-variable.

    So... does an event-variable have to be a coarray? It would make
    sense, certainly, but I see nothing prescribing it. Or am I missing
    something?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From miesiehl@gmail.com@21:1/5 to Thomas Koenig on Sun Feb 27 13:07:21 2022
    Thomas Koenig schrieb am Freitag, 25. Februar 2022 um 08:19:06 UTC+1:
    Just looking through J3/18-007r1 ...

    11.6.7 says

    R1171 event-variable is scalar-variable

    C1176 (R1171) An event-variable shall be of type EVENT_TYPE from
    the intrinsic module ISO_FORTRAN- ENV (16.10.2).

    Clear so far.

    11.6.8 tells me

    C1177 (R1172) The event-variable in an event-wait-stmt shall not
    be coindexed.

    and

    The event-variable shall not depend on the value of stat-variable
    or errmsg-variable.

    So... does an event-variable have to be a coarray? It would make
    sense, certainly, but I see nothing prescribing it. Or am I missing something?

    I don‘t use Events with my CAF codes and I usually don‘t refer to the standards text. Modern Fortran explained, p.395, says “An event variable must be a coarray or a component of a coarray;...”.
    Using coarray components as event variables is also allowed and even the only way for using Events with distributed objects models (using OOP syntax to implement the distributed objects).
    OpenCoarrays/gfortran does currently only support the use of ordinary coarrays as event variables (and gives a compile time message if you try another form), ifort does allow all three forms for use with event variables:

    program event_example
    ! using a coarray
    use iso_fortran_env
    implicit none
    type(event_type), codimension[*] :: ev
    integer a[*]
    integer b
    if (this_image()==1) then
    event wait(ev)
    b = a[2]
    write(*,*)'image1, b value:',b
    else if (this_image()==2) then
    write(*,*)'image2'
    a = 77
    event post(ev[1])
    end if
    end program event_example

    program event_example
    ! using a component of a coarray
    use iso_fortran_env
    implicit none
    type t
    type(event_type) ev
    end type t
    type(t), codimension[*] :: t1
    integer a[*]
    integer b
    if (this_image()==1) then
    event wait(t1%ev)
    b = a[2]
    write(*,*)'image1, b value:',b
    else if (this_image()==2) then
    write(*,*)'image2'
    a = 77
    event post(t1[1]%ev)
    end if
    end program event_example

    program event_example
    ! using a coarray component
    use iso_fortran_env
    implicit none
    type t
    type(event_type), codimension[:], allocatable :: ev
    end type t
    type(t) t1
    integer a[*]
    integer b
    allocate (t1%ev[*])
    if (this_image()==1) then
    event wait(t1%ev)
    b = a[2]
    write(*,*)'image1, b value:',b
    else if (this_image()==2) then
    write(*,*)'image2'
    a = 77
    event post(t1%ev[1])
    end if
    end program event_example

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From rbader@21:1/5 to Thomas Koenig on Mon Feb 28 05:35:55 2022
    Thomas Koenig schrieb am Freitag, 25. Februar 2022 um 08:19:06 UTC+1:
    Just looking through J3/18-007r1 ...

    11.6.7 says

    R1171 event-variable is scalar-variable

    C1176 (R1171) An event-variable shall be of type EVENT_TYPE from
    the intrinsic module ISO_FORTRAN- ENV (16.10.2).

    Clear so far.

    11.6.8 tells me

    C1177 (R1172) The event-variable in an event-wait-stmt shall not
    be coindexed.

    and

    The event-variable shall not depend on the value of stat-variable
    or errmsg-variable.

    So... does an event-variable have to be a coarray? It would make
    sense, certainly, but I see nothing prescribing it. Or am I missing something?

    The requirement that event variables be coarrays is in 16.10.2.10 (C1604).

    Regards
    Reinhold

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From gah4@21:1/5 to Thomas Koenig on Mon Feb 28 07:40:58 2022
    On Thursday, February 24, 2022 at 11:19:06 PM UTC-8, Thomas Koenig wrote:

    (snip)

    So... does an event-variable have to be a coarray? It would make
    sense, certainly, but I see nothing prescribing it. Or am I missing something?

    I would have thought EVENT variables would be used with
    asynchronous I/O, and then would not be coarrays, but then I haven't
    tried using asynchronous I/O in Fortran.

    The underlying I/O model for many IBM OSs is asynchronous, based on
    the ECB, event control block, which I believe is related to event variables in some high-level languages.

    Programs can test the ECB for completion, and then when appropriate,
    WAIT on one (or more). You can, for example, wait for only some of a
    group of ECB to complete, such as only one, and then handle the completed
    on as appropriate. That is, have many outstanding events, and handle them
    as they complete.

    But I don't see why that should be coarrays.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Thomas Koenig@21:1/5 to rbader on Mon Feb 28 17:47:50 2022
    rbader <Bader@lrz.de> schrieb:
    Thomas Koenig schrieb am Freitag, 25. Februar 2022 um 08:19:06 UTC+1:
    Just looking through J3/18-007r1 ...

    11.6.7 says

    R1171 event-variable is scalar-variable

    C1176 (R1171) An event-variable shall be of type EVENT_TYPE from
    the intrinsic module ISO_FORTRAN- ENV (16.10.2).

    Clear so far.

    11.6.8 tells me

    C1177 (R1172) The event-variable in an event-wait-stmt shall not
    be coindexed.

    and

    The event-variable shall not depend on the value of stat-variable
    or errmsg-variable.

    So... does an event-variable have to be a coarray? It would make
    sense, certainly, but I see nothing prescribing it. Or am I missing
    something?

    The requirement that event variables be coarrays is in 16.10.2.10 (C1604).

    Ah, in the section describing EVENT_TYPE. I only searched the standard
    for event-variable, not for that.

    Thanks!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Thomas Koenig@21:1/5 to gah4@u.washington.edu on Mon Feb 28 17:52:50 2022
    gah4 <gah4@u.washington.edu> schrieb:
    On Thursday, February 24, 2022 at 11:19:06 PM UTC-8, Thomas Koenig wrote:

    (snip)

    So... does an event-variable have to be a coarray? It would make
    sense, certainly, but I see nothing prescribing it. Or am I missing
    something?

    I would have thought EVENT variables would be used with
    asynchronous I/O, and then would not be coarrays, but then I haven't
    tried using asynchronous I/O in Fortran.

    Asynchronous I/O is quite a different kettle of fish. For
    asynchronous I/O, you open a file as asynchronous, you read or
    write with ASYNCHRONOUS="YES", you do something else, and you wait
    (either with an explicit WAIT statement or with a non-asynchronous
    statement).


    The underlying I/O model for many IBM OSs is asynchronous, based on
    the ECB, event control block, which I believe is related to event variables in
    some high-level languages.

    For Fortran, an event is something different.


    Programs can test the ECB for completion, and then when appropriate,
    WAIT on one (or more). You can, for example, wait for only some of a
    group of ECB to complete, such as only one, and then handle the completed
    on as appropriate. That is, have many outstanding events, and handle them
    as they complete.

    That sounds similar to the Fortran model of asynchronous I/O (although
    gfortran implements that using pthreads).

    But I don't see why that should be coarrays.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)