Difference between pages "Proc" and "Sync"

From Mesham
(Difference between pages)
Jump to navigationJump to search
 
(Created page with '== Syntax == sync name; == Semantics Will synchronise processes where they are needed. For instance, if using the asynchronous communication type, the programmer can synchron…')
 
Line 1: Line 1:
 
== Syntax ==
 
== Syntax ==
  
proc n<br>
+
sync name;
{<br>
 
process body<br>
 
}
 
  
where ''n'' is a variable or value known at compile time.
+
== Semantics
  
== Semantics ==
+
Will synchronise processes where they are needed. For instance, if using the asynchronous communication type, the programmer can synchronise with a variable name and the keyword will ensure all communications of that variable are up to date. One sided communication (variable sharing MPMD style in a par loop) is also linked into this keyword and it will ensure all communication is completed. Without a variable will synchronise all outstanding variables that need synchronising. If a process has no variables that need syncing then it will ignore this keyword and continue.
  
This will limit execution of a block to a certain process whose rank is guaranteed to be that specified.<br><br>
 
''Note:'' A variable declared within a proc block and allocated multiple will in fact, by inference, be allocated to the group of processes which contains a single process who's rank is the same as the proc block's.
 
 
== Example ==
 
 
#include <io>
 
function void main() {
 
    proc 0 {
 
      print("Hello from 0\n");
 
    };
 
 
    proc 1 {
 
      print("hello from 1\n");
 
    };
 
};
 
 
The code example will run on two processes, the first will display the message ''Hello from 0'', whilst the second will output the message ''hello from 1''.
 
 
''Since: Version 0.41b''
 
 
[[Category:Parallel]]
 
[[Category:Parallel]]

Revision as of 23:52, 3 January 2010

Syntax

sync name;

== Semantics

Will synchronise processes where they are needed. For instance, if using the asynchronous communication type, the programmer can synchronise with a variable name and the keyword will ensure all communications of that variable are up to date. One sided communication (variable sharing MPMD style in a par loop) is also linked into this keyword and it will ensure all communication is completed. Without a variable will synchronise all outstanding variables that need synchronising. If a process has no variables that need syncing then it will ignore this keyword and continue.