Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/01/11 17:37:05 (13 years ago)
Author:
svonolfe
Message:

Added first version of the MPIEngine (#1542)

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  
    3434  /// </summary>
    3535  [Serializable]
    36   class MPITransportWrapper<T>: ISerializable where T: class, IItem {
     36  public class MPITransportWrapper<T>: ISerializable where T: class, IItem {
    3737    [NonSerialized]
    3838    private T innerItem;
  • branches/MPI/HeuristicLab.Operators.MPISupport/3.3/MPIUnidirectionalRingMigrator.cs

    r6347 r6354  
    4343    }
    4444
     45    public static int Channel = 100;
     46
    4547    public override IOperation Apply() {
    4648      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) {
    4951          int i = MPI.Communicator.world.Rank;
    5052          IScope scope = ExecutionContext.Scope;
     
    5254          IScope emigrants = scope.SubScopes[1];
    5355          scope.SubScopes.Remove(emigrants);
    54           int recipent = (i + 1) % size;
     56          int recipent = i + 1;
     57          if (recipent == size)
     58            recipent = 1;
    5559
    5660          Console.WriteLine("MIGRATE " + i + " TO " + recipent);
    5761          MPI.Communicator.world.Send<MPITransportWrapper<IScope>>(
    58             new MPITransportWrapper<IScope>(emigrants), recipent, 0);
     62            new MPITransportWrapper<IScope>(emigrants), recipent, Channel);
    5963
    6064          IScope immigrants = null;
    6165          int sender = i - 1;
    62           if (sender < 0)
     66          if (sender < 1)
    6367            sender = size - 1;
    6468
    6569          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;
    6771
    6872          scope.SubScopes.Add(immigrants);
Note: See TracChangeset for help on using the changeset viewer.