Difference between revisions of "Ready"
From Mesham
Jump to navigationJump to searchm |
m (6 revisions imported) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 9: | Line 9: | ||
== Example == | == Example == | ||
− | var a:Int::allocated[single[on[1]]]; | + | function void main() { |
− | + | var a:Int::allocated[single[on[1]]]; | |
− | + | var b:Int::allocated[single[on[2]]] :: ready[]; | |
− | + | var c:Int::allocated[single[on[2]]] :: ready[] :: nonblocking[]; | |
− | + | a:=b; | |
+ | a:=c; | ||
+ | }; | ||
The send of assignment ''a:=b'' will only begin once the receive from process 1 has been issued. With the statement ''a:=c'' the send, even though it is [[nonblocking]], will only start once a matching receive has been issued too. | The send of assignment ''a:=b'' will only begin once the receive from process 1 has been issued. With the statement ''a:=c'' the send, even though it is [[nonblocking]], will only start once a matching receive has been issued too. | ||
− | ''Since: Version 0. | + | ''Since: Version 0.5'' |
[[Category:Type Library]] | [[Category:Type Library]] | ||
[[Category:Compound Types]] | [[Category:Compound Types]] | ||
[[Category:Communication Mode Types]] | [[Category:Communication Mode Types]] |
Latest revision as of 15:44, 15 April 2019
Syntax
ready[ ]
Semantics
The ready type will force P2P Send to start only if a matching receive has been posted by the target processor. When used in conjunction with the nonblocking type, communication start will wait until a matching receive is posted. This type acts as a form of handshaking and can improve performance in some uses.
Example
function void main() { var a:Int::allocated[single[on[1]]]; var b:Int::allocated[single[on[2]]] :: ready[]; var c:Int::allocated[single[on[2]]] :: ready[] :: nonblocking[]; a:=b; a:=c; };
The send of assignment a:=b will only begin once the receive from process 1 has been issued. With the statement a:=c the send, even though it is nonblocking, will only start once a matching receive has been issued too.
Since: Version 0.5