Partitioning
Next: Horizontal,
Previous: Allreduce,
Index: Index
Quite often in HPC applications the programmer wishes to split up data in some way, shape or form. This is often a difficult task, resulting in complex code with reduced efficiency. Mesham provides types to allow for the partitioning and distribution of data quite easily. It should be noted that, although at the moment partitioning and distribution types are quite limited, the infrastructure is there to allow for much more complex operations to be performed if and when they are needed.
When the programmer partitions data, the compiler splits it up into blocks (an internal type of the compiler.) The location of these blocks depends on the distribution type used - it is possible for all the blocks to be located on one process, on a few or on all and if there are more blocks than processes they can always "wrap around." The whole idea is that the programmer can refer to separate blocks without needing to worry about exactly where they are located, this means that its very easy to change the distribution method to something more efficient later down the line.
There are actually two types of partitioning - partitioning for distribution and partitioning for viewing. The partition type located inside the allocated type is the partition for distribution (and also the default view of the data.) However, if the programmer wishes to change the way they are viewing the blocks of data later down the line, then a different partition type can be coherced. This will modify the view of the data, but NOT the underlying way that the data is allocated and distributed amongst the processes. Of course, it is important to avoid an ambigous combination of partition types!
In order to access a certain block of a partition, simply use methodinvoke # or [] i.e. (a#3) will access the 3rd block of variable a.
var a:array[Int,10,20] :: allocated[A[m] :: single[D[]]];
In the code above, a is declared to be a 2d array size 10 by 20, using partition type (method) A and splitting the data into m blocks. These blocks are distributed amongst the processes via distribution method D.
a:(a::B[]);
Here the partition B is coherced with the type of a, and the view of the data changes from A to B.
Last Modified: August 2008