Changeset 6354 for branches/MPI/HeuristicLab.Operators.MPISupport/3.3
- Timestamp:
- 06/01/11 17:37:05 (13 years ago)
- Location:
- branches/MPI/HeuristicLab.Operators.MPISupport/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/MPI/HeuristicLab.Operators.MPISupport/3.3/MPITransportWrapper.cs
r6347 r6354 34 34 /// </summary> 35 35 [Serializable] 36 class MPITransportWrapper<T>: ISerializable where T: class, IItem {36 public class MPITransportWrapper<T>: ISerializable where T: class, IItem { 37 37 [NonSerialized] 38 38 private T innerItem; -
branches/MPI/HeuristicLab.Operators.MPISupport/3.3/MPIUnidirectionalRingMigrator.cs
r6347 r6354 43 43 } 44 44 45 public static int Channel = 100; 46 45 47 public override IOperation Apply() { 46 48 if (MPI.Communicator.world != null) { 47 int size = MPI.Communicator.world. Group.Size;48 if (size > 1) {49 int size = MPI.Communicator.world.Size; 50 if (size > 2) { 49 51 int i = MPI.Communicator.world.Rank; 50 52 IScope scope = ExecutionContext.Scope; … … 52 54 IScope emigrants = scope.SubScopes[1]; 53 55 scope.SubScopes.Remove(emigrants); 54 int recipent = (i + 1) % size; 56 int recipent = i + 1; 57 if (recipent == size) 58 recipent = 1; 55 59 56 60 Console.WriteLine("MIGRATE " + i + " TO " + recipent); 57 61 MPI.Communicator.world.Send<MPITransportWrapper<IScope>>( 58 new MPITransportWrapper<IScope>(emigrants), recipent, 0);62 new MPITransportWrapper<IScope>(emigrants), recipent, Channel); 59 63 60 64 IScope immigrants = null; 61 65 int sender = i - 1; 62 if (sender < 0)66 if (sender < 1) 63 67 sender = size - 1; 64 68 65 69 Console.WriteLine("MIGRATE " + i + " FROM " + sender); 66 immigrants = MPI.Communicator.world.Receive<MPITransportWrapper<IScope>>(sender, 0).InnerItem;70 immigrants = MPI.Communicator.world.Receive<MPITransportWrapper<IScope>>(sender, Channel).InnerItem; 67 71 68 72 scope.SubScopes.Add(immigrants);
Note: See TracChangeset
for help on using the changeset viewer.