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