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