1 |
mojays |
2 |
package appl.parallel.spmd.split; |
2 |
|
|
|
3 |
|
|
import java.awt.Rectangle; |
4 |
|
|
import java.io.Serializable; |
5 |
|
|
import java.net.InetAddress; |
6 |
|
|
|
7 |
|
|
import appl.parallel.spmd.split.SplittableResource; |
8 |
|
|
import appl.parallel.spmd.split.AbstractSplitMap.NeighborhoodBoxingMode; |
9 |
|
|
|
10 |
|
|
/** |
11 |
|
|
* Defines a split map over a {@link SplittableResource}. A split map is a |
12 |
|
|
* layout of an actual partitioning. Each partition is associated with a number, |
13 |
|
|
* ranging from 0 to noOfPartitions-1. |
14 |
|
|
* <br> |
15 |
|
|
* The partitions are layouted as rectangles, where each rectangle represents a partition |
16 |
|
|
* or a neighborhood around a partition. Every partition or neighborhood can be queried. |
17 |
|
|
* IP-Addresses can be associated with partitions to identify the server on which a partition is located. |
18 |
|
|
* <br> |
19 |
|
|
* The interface is largely implementation independent. Multiple implementations exist. |
20 |
|
|
* |
21 |
|
|
* You can query the SplitMap for neighbors of a partition. |
22 |
|
|
* |
23 |
|
|
* @see SplitMap1DHorizontal |
24 |
|
|
* @see SplitMap1DVertical |
25 |
|
|
* @see SplitMap2D |
26 |
|
|
* @see AbstractSplitMap |
27 |
|
|
* |
28 |
|
|
* @author Dominik Appl |
29 |
|
|
*/ |
30 |
|
|
public interface SplitMap extends Serializable{ |
31 |
|
|
|
32 |
|
|
/** |
33 |
|
|
* returns an Array of neighbors for that position in the splitmap. |
34 |
|
|
* |
35 |
|
|
* @param pos position in splitmap |
36 |
|
|
* @return the array |
37 |
|
|
* |
38 |
|
|
*/ |
39 |
|
|
int[] getNeighborsForPosition(int pos); |
40 |
|
|
|
41 |
|
|
|
42 |
|
|
/** |
43 |
|
|
* With this setter, you can assign each partition a weight, so that |
44 |
|
|
* the data you split is not splitted equally, but arcording to |
45 |
|
|
* these values. A value of weights specifies how big the share of the |
46 |
|
|
* partition with this position is. The sum of all values |
47 |
|
|
* should be 1 or near to 1. |
48 |
|
|
* |
49 |
|
|
* @param weights |
50 |
|
|
* @throws UnsupportedOperationException if the number of weights does |
51 |
|
|
* not match the number of partitions |
52 |
|
|
*/ |
53 |
|
|
public void setWeights(double... weights); |
54 |
|
|
|
55 |
|
|
/** |
56 |
|
|
* @return a short description of the type of the Splitting |
57 |
|
|
*/ |
58 |
|
|
public String getDescription(); |
59 |
|
|
|
60 |
|
|
/** |
61 |
|
|
* @param pos the partition number |
62 |
|
|
* @return the bounds of the partiton calculation area in global coordinates |
63 |
|
|
*/ |
64 |
|
|
public Rectangle getPartitionCalculationBounds(int pos); |
65 |
|
|
|
66 |
|
|
/** |
67 |
|
|
* @param pos the partition number |
68 |
|
|
* @return the bounds of the partiton neighborhood area in global coordinates |
69 |
|
|
*/ |
70 |
|
|
public Rectangle getPartitionNeighborhoodBounds(int pos); |
71 |
|
|
|
72 |
|
|
/** |
73 |
|
|
* @param pos the partition number |
74 |
|
|
* @return the bounds of the partiton in global coordinates, |
75 |
|
|
* which should be the same as {@link #getPartitionNeighborhoodBounds(int)} |
76 |
|
|
* |
77 |
|
|
*/ |
78 |
|
|
public Rectangle getPartitionBounds(int pos); |
79 |
|
|
|
80 |
|
|
|
81 |
|
|
/** |
82 |
|
|
* @return {@link #getGlobalBounds()} |
83 |
|
|
*/ |
84 |
|
|
public Rectangle getGlobalCalculationBounds(); |
85 |
|
|
|
86 |
|
|
/** |
87 |
|
|
* @return the bounds of the whole area starting with 0,0 in the topleft corner |
88 |
|
|
*/ |
89 |
|
|
public Rectangle getGlobalBounds(); |
90 |
|
|
|
91 |
|
|
/** |
92 |
|
|
* Gets the whole partition bounds (including available neighborhood) |
93 |
|
|
* @param pos the partition number |
94 |
|
|
* @return the bounds of the partition using local coordinates. (0,0) is the topleft corner. |
95 |
|
|
*/ |
96 |
|
|
public Rectangle getLocalBounds(int pos); |
97 |
|
|
/** |
98 |
|
|
* @param pos the partition number |
99 |
|
|
* @return the calculation bounds of the partition using local coordinates. |
100 |
|
|
*/ |
101 |
|
|
public Rectangle getLocalCalculationBounds(int pos); |
102 |
|
|
/** |
103 |
|
|
* @param pos the partition number |
104 |
|
|
* @return the bounds of the partition using local coordinates. (0,0) is the topleft corner. |
105 |
|
|
*/ |
106 |
|
|
public Rectangle getLocalNeighborhoodBounds(int pos); |
107 |
|
|
|
108 |
|
|
|
109 |
|
|
/** |
110 |
|
|
* Sets the given values. Call makeMap() for this changes to take effekt. |
111 |
|
|
* |
112 |
|
|
* @param splittable the resource on which the splitmap is calculated |
113 |
|
|
* @param neighborhoodRange the neighborhoodrange |
114 |
|
|
* @param noOfPartitions the number of partitions to be generated |
115 |
|
|
* @param boxingMode the boxing mode |
116 |
|
|
* |
117 |
|
|
*/ |
118 |
|
|
public void setParameters(SplittableResource splittable, int neighborhoodRange, |
119 |
|
|
int noOfPartitions, |
120 |
|
|
NeighborhoodBoxingMode boxingMode); |
121 |
|
|
|
122 |
|
|
/** |
123 |
|
|
* @param IPs a String Array of IPs which are mapped to the partition in the given order. |
124 |
|
|
* |
125 |
|
|
*/ |
126 |
|
|
public void setIPs(String IPs[]); |
127 |
|
|
/** |
128 |
|
|
* @param pos position for this splitmap |
129 |
|
|
* @return the IP associated with this position |
130 |
|
|
*/ |
131 |
|
|
public String getIP(int pos); |
132 |
|
|
|
133 |
|
|
/** |
134 |
|
|
* @return the neighborhoodRange |
135 |
|
|
*/ |
136 |
|
|
public int getNeighborhoodRange(); |
137 |
|
|
|
138 |
|
|
/** |
139 |
|
|
* Creates the map |
140 |
|
|
*/ |
141 |
|
|
public void makeMap(); |
142 |
|
|
|
143 |
|
|
/** |
144 |
|
|
* @return the number of partitions |
145 |
|
|
*/ |
146 |
|
|
public int getCount(); |
147 |
|
|
} |