1 |
package appl.parallel.spmd; |
2 |
|
3 |
import appl.parallel.server.PartitionDataManager; |
4 |
import appl.parallel.spmd.split.DataPartition; |
5 |
|
6 |
/** |
7 |
* Performance optimizations can be made with this type of controller. It allows heavy |
8 |
* multithreading. Also allows preloading of partitions using SyncPoints. |
9 |
* |
10 |
* @author Dominik Appl |
11 |
*/ |
12 |
public interface AdvancedSPMDServerInterface extends SPMDServerInterface { |
13 |
/** |
14 |
* The partition is loaded in a separate thread into the local {@link PartitionDataManager} |
15 |
* You must specify the partitionname and a {@link SyncPoint}. |
16 |
* You can specifiy a priority for the thread in the {@link SyncPoint} |
17 |
* |
18 |
* @param partition the name of the partition for identification |
19 |
* @param s the associated {@link SyncPoint} |
20 |
* |
21 |
* @see appl.parallel.spmd.AdvancedSPMDClientInterface#mergePartition(java.lang.Object, appl.parallel.spmd.SyncPoint) |
22 |
* @see SPMDServerController#getPartition(String) |
23 |
* |
24 |
*/ |
25 |
public void preloadPartition(String partition, SyncPoint s); |
26 |
|
27 |
/** |
28 |
* The partition is loaded in a separate thread into the local {@link PartitionDataManager} |
29 |
* You must specify the partitionname and a {@link SyncPoint}. |
30 |
* You can specifiy a priority for the thread in the {@link SyncPoint} |
31 |
* |
32 |
* @param partition the name of the partition for identification |
33 |
* @param idx the index of the partition in the multidata object |
34 |
* @param s the associated {@link SyncPoint} |
35 |
* |
36 |
* @see appl.parallel.spmd.AdvancedSPMDClientInterface#mergePartition(java.lang.Object, appl.parallel.spmd.SyncPoint) |
37 |
* @see SPMDServerController#getPartition(String) |
38 |
* |
39 |
*/ |
40 |
public void preloadMultiPartition(String partition, int idx, SyncPoint s); |
41 |
|
42 |
|
43 |
/** |
44 |
* Waits until the Thread with the specified SyncPoint finishes. After that |
45 |
* the Thread is removed. A second call will cause a exeception. |
46 |
* |
47 |
* @param s |
48 |
* the {@link SyncPoint} |
49 |
* @throws UnsupportedOperationException |
50 |
* if a thread with the specified SyncPoint was not found or was |
51 |
* already synchronized! |
52 |
*/ |
53 |
public void synchronizeToSyncPoint(SyncPoint s); |
54 |
|
55 |
/** |
56 |
* If there are multiple processors on the machine and the current task |
57 |
* supports |
58 |
* {@link SPMDTask#supportsMultiThreading() supports multithreading} there |
59 |
* are several threads created. Each thread uses a different |
60 |
* {@link SPMDServerInterface#getLocalCalculationBounds(DataPartition) calculation area}. Now there might |
61 |
* be parts of the taskcode were multithreading is undesired, e.g. when |
62 |
* operations affect the whole partition. In this case you should use this |
63 |
* method to guarantee that only one thread has access to a code block. |
64 |
* |
65 |
* @return whether this thread is the "master" thread, which means whether this thread |
66 |
* refers to the first task created. |
67 |
*/ |
68 |
public boolean isMasterThread(); |
69 |
|
70 |
/** |
71 |
* You should call this method from time to time to clear all syncpoints and the associated |
72 |
* threads out of the memory |
73 |
*/ |
74 |
public void clearSyncData(); |
75 |
|
76 |
|
77 |
} |