Exemple #1
0
        public override void client()
        {
            Console.WriteLine("ROOT CLIENT PROCESS");

            int r = RootCommunicator.Allreduce(44, minus);

            Console.WriteLine("ROOT CALCULATED " + r);

            StartClient(r.ToString());
        }
        private void listen_worker()
        {
            Tuple <int, int> operation;

            MPI.CompletedStatus status = null;

            Trace.WriteLineIf(this.TraceFlag == true, "listen_workers - WAITING ... " + MPI.Environment.Threading);

            //lock (lock_recv)
            RootCommunicator.Receive <Tuple <int, int> >
                (MPI.Communicator.anySource,
                TAG_SEND_OPERATION,
                out operation,
                out status);

            Trace.WriteLineIf(this.TraceFlag == true, "listen_workers - RECEIVED FROM WORKER source=" + status.Source + ", tag=" + status.Tag + " / operation = " + operation);

            switch (operation.Item1)
            {
            case AliencommunicatorOperation.SEND:
            case AliencommunicatorOperation.SEND_ARRAY:
                (new Thread(() => handle_SEND(operation, status))).Start();
                break;

            case AliencommunicatorOperation.RECEIVE:
            case AliencommunicatorOperation.RECEIVE_ARRAY:
                (new Thread(() => handle_RECEIVE(operation, status))).Start();
                break;

            case AliencommunicatorOperation.PROBE:
                (new Thread(() => handle_PROBE(operation, status))).Start();
                break;

            case AliencommunicatorOperation.ALL_GATHER:
                (new Thread(() => handle_ALL_GATHER(operation, status))).Start();
                break;

            case AliencommunicatorOperation.ALL_GATHER_FLATTENED:
                (new Thread(() => handle_ALL_GATHER_FLATTENED(operation, status))).Start();
                break;

            case AliencommunicatorOperation.ALL_REDUCE:
                handle_ALL_REDUCE(operation, status);
                break;

            case AliencommunicatorOperation.ALL_REDUCE_ARRAY:
                (new Thread(() => handle_ALL_REDUCE(operation, status))).Start();
                break;

            case AliencommunicatorOperation.ALL_TO_ALL:
                (new Thread(() => handle_ALL_TO_ALL(operation, status))).Start();
                break;

            case AliencommunicatorOperation.ALL_TO_ALL_FLATTENED:
                (new Thread(() => handle_ALL_TO_ALL_FLATTENED(operation, status))).Start();
                break;

            case AliencommunicatorOperation.REDUCE_SCATTER:
                (new Thread(() => handle_REDUCE_SCATTER(operation, status))).Start();
                break;

            case AliencommunicatorOperation.BROADCAST:
                (new Thread(() => handle_BROADCAST(operation, status))).Start();
                break;

            case AliencommunicatorOperation.BROADCAST_ARRAY:
                (new Thread(() => handle_BROADCAST(operation, status))).Start();
                break;

            case AliencommunicatorOperation.SCATTER:
                handle_SCATTER(operation, status);
                break;

            case AliencommunicatorOperation.SCATTER_FROM_FLATTENED:
                (new Thread(() => handle_SCATTER_FROM_FLATTENED(operation, status))).Start();
                break;

            case AliencommunicatorOperation.GATHER:
                (new Thread(() => handle_GATHER(operation, status))).Start();
                break;

            case AliencommunicatorOperation.GATHER_FLATTENED:
                (new Thread(() => handle_GATHER_FLATTENED(operation, status))).Start();
                break;

            case AliencommunicatorOperation.REDUCE:
                (new Thread(() => handle_REDUCE(operation, status))).Start();
                break;

            case AliencommunicatorOperation.REDUCE_ARRAY:
                (new Thread(() => handle_REDUCE(operation, status))).Start();
                break;

            default:
                Trace.WriteLineIf(this.TraceFlag == true, "UNRECOGNIZED OPERATION");
                throw new ArgumentOutOfRangeException();
            }
        }