Open brandongc opened 2 years ago
Presumably this will inspire us to remove the requirement that objects of event_type
must be coarrays, which is constraint C1604 in the Fortran 2018 standard.
I am thinking that this could generalize to any CALL statement with the introduction of the syntax
CALL [ ( call-control-spec-list ) ] procedure-designator [ ( [ actual-arg-spec-list ] ) ] call-control-spec is [ EVENT = ] event-variable
There will be a need for a new intrinsic function (CALL?) with no arguments whose return value is the event-variable (or a pointer associated with it?) of the currently executing CALL.
This is just musing. Do you know of any work on similar ideas?
There will be a need for a new intrinsic function (CALL?) with no arguments whose return value is the event-variable (or a pointer associated with it?) of the currently executing CALL.
Can you elaborate on this? I'm not sure I'm following. Couldn't there be multiple currently executing "calls"? I.e.
type(event_type) :: a, b
call co_sum(x, event=a)
call co_sum(y, event=b)
! Do something independent of x and y
event wait (a)
! do something with x
event wait (b)
! do something with y
This is just musing. Do you know of any work on similar ideas?
https://github.com/jeffhammond/j3/blob/main/asynchronous_tasks.md is possibly related.
type(event_type) :: a, b
call (EVENT=a) process(x)
call (EVENT=b) process(y)
! Do something independent of x and y
event wait (a)
! do something with x
event wait (b)
! do something with y
During execution of "process(x)"/"process(y)", the intrinsic function "CALL()" returns a/b, respectively.
Interesting idea. Does that imply
CALL
function (I might give that a different name)
- new intrinsic
CALL
function (I might give that a different name)
You mean CALL
statement?
Re: "different name" - CO_CALL
? !!!: :-))
block-stmt is [ block-construct-name : ] BLOCK [ ( call-control-spec-list )
if you must!
Instead of an intrinsic function, an intrinsic subroutine would allow for EVENT= and STAT= arguments, to handle the case where no event has been associated by the executing BLOCK or SUBROUTINE.
This is analogous to the widely used immediate (or non-blocking) collectives in MPI.
Benefits: