1 |
mojays |
2 |
package appl.parallel.spmd; |
2 |
|
|
|
3 |
|
|
import java.awt.Rectangle; |
4 |
|
|
import java.io.Serializable; |
5 |
|
|
|
6 |
|
|
import appl.parallel.server.XuluServer; |
7 |
mojays |
114 |
import de.schmitzm.geotools.data.WritableGrid; |
8 |
mojays |
2 |
|
9 |
|
|
/** |
10 |
|
|
* A SPMDTask should be executed on servers using the SPMD-paradigm. |
11 |
|
|
* <br> |
12 |
|
|
* The Task provides access to the {@link SPMDClientInterface} and the |
13 |
|
|
* {@link AdvancedSPMDClientInterface}. <br> |
14 |
|
|
* <br> |
15 |
|
|
* @see AbstractSPMDTask for more details |
16 |
|
|
* |
17 |
|
|
* @author Dominik Appl |
18 |
|
|
*/ |
19 |
|
|
public interface SPMDTask extends Serializable { |
20 |
|
|
|
21 |
|
|
/** |
22 |
|
|
* Gives access the {@link AdvancedSPMDServerInterface} for advanced parallel |
23 |
|
|
* programming, including performance optimizations like preloading. |
24 |
|
|
* @return the interface |
25 |
|
|
*/ |
26 |
|
|
public AdvancedSPMDServerInterface getAdvancedSPMDServerController(); |
27 |
|
|
|
28 |
|
|
/** |
29 |
|
|
* Gives access the {@link SPMDServerInterface} for parallel programming. |
30 |
|
|
* |
31 |
|
|
* @return the interface |
32 |
|
|
*/ |
33 |
|
|
public SPMDServerInterface getSPMDServerController(); |
34 |
|
|
|
35 |
|
|
/** |
36 |
|
|
* Associates the given SPMDController with the task. Will be called e.g. by |
37 |
|
|
* the {@link XuluServer}. |
38 |
|
|
* |
39 |
|
|
* @param controller |
40 |
|
|
*/ |
41 |
|
|
public void setSPMDServerController(AdvancedSPMDServerInterface controller); |
42 |
|
|
|
43 |
|
|
/** |
44 |
|
|
* Currently not used. May be used later when introducing write access on |
45 |
|
|
* neighborhood regions. |
46 |
|
|
* |
47 |
|
|
* @param incomingGrid |
48 |
|
|
* @param location |
49 |
|
|
*/ |
50 |
|
|
public void outgoingUpdate(WritableGrid incomingGrid, Rectangle location); |
51 |
|
|
|
52 |
|
|
/** |
53 |
|
|
* Currently not used. May be used later when introducing write access on |
54 |
|
|
* neighborhood regions. |
55 |
|
|
* |
56 |
|
|
* @param outgoingGrid |
57 |
|
|
* @param location |
58 |
|
|
*/ |
59 |
|
|
public void incomingUpdate(WritableGrid outgoingGrid, Rectangle location); |
60 |
|
|
|
61 |
|
|
/** |
62 |
|
|
* Starts the task with the given parameters. Overwrite this method to |
63 |
|
|
* implement the task. |
64 |
|
|
* |
65 |
|
|
* @param parameters |
66 |
|
|
* @return the result of the task computation (if any) |
67 |
|
|
*/ |
68 |
|
|
public Object run(Object... parameters); |
69 |
|
|
|
70 |
|
|
/** |
71 |
|
|
* Initializes the task. Initializing is only done once! |
72 |
|
|
*/ |
73 |
|
|
public void initialize(); |
74 |
|
|
|
75 |
|
|
/** |
76 |
|
|
* @return whether the task is initialized or {@link #initialize()} must be |
77 |
|
|
* called |
78 |
|
|
*/ |
79 |
|
|
public boolean isInitialized(); |
80 |
|
|
|
81 |
|
|
/** |
82 |
|
|
* If you want to support multiple processors, this method must return true. |
83 |
|
|
* |
84 |
|
|
* @return whether multithreading can be used by this task |
85 |
|
|
*/ |
86 |
|
|
public boolean supportsMultiThreading(); |
87 |
|
|
|
88 |
|
|
} |