示例#1
0
        public void Receive <T> (Tuple <int, int> source, int tag, out T value, out br.ufc.mdcc.hpc.storm.binding.channel.Binding.CompletedStatus status)
        {
            int conversation_tag = takeNextConversationTag();

            Console.WriteLine(this.PeerRank + ": 1 - BEGIN RECV FROM <" + source.Item1 + "," + source.Item2 + "> : " + TAG_SEND_OPERATION);
            this.RootCommunicator.Send <Tuple <int, int> >(new Tuple <int, int>(AliencommunicatorOperation.RECEIVE, conversation_tag), 0, TAG_SEND_OPERATION);
            Console.WriteLine(this.PeerRank + ": 2 - BEGIN RECV FROM <" + source.Item1 + "," + source.Item2 + "> : " + conversation_tag);
            this.RootCommunicator.Send <Tuple <int, int, int> > (new Tuple <int, int, int>(source.Item1, source.Item2, tag), 0, conversation_tag);
            Console.WriteLine(this.PeerRank + ": 3 - BEGIN RECV FROM <" + source.Item1 + "," + source.Item2 + "> : " + tag);
            MPI.CompletedStatus status_root;
            byte[] v;
            this.RootCommunicator.Receive <byte[]> (0, tag, out v, out status_root);
            value = (T)ByteArrayToObject(v);
            Console.WriteLine(this.PeerRank + ": 4 - END RECV FROM <" + source.Item1 + "," + source.Item2 + ">");

            status = br.ufc.mdcc.hpc.storm.binding.channel.Binding.CompletedStatus.createStatus(status_root, source);
        }
示例#2
0
        public void Receive <T> (Tuple <int, int> source, int tag, ref T[] values, out br.ufc.mdcc.hpc.storm.binding.channel.Binding.CompletedStatus status)
        {
            int conversation_tag = takeNextConversationTag();

            this.RootCommunicator.Send <Tuple <int, int> >(new Tuple <int, int>(AliencommunicatorOperation.RECEIVE_ARRAY, conversation_tag), 0, TAG_SEND_OPERATION);
            this.RootCommunicator.Send <Tuple <int, int, int> > (new Tuple <int, int, int>(source.Item1, source.Item2, tag), 0, conversation_tag);
            MPI.CompletedStatus status_root;
            byte[] v;
            this.RootCommunicator.Receive <byte[]> (0, tag, out v, out status_root);
            T[] values_ = (T[])ByteArrayToObject(v);

            // Copy the received values to the destination array (forcing original MPI semantics)
            int size = values.Length <= values_.Length ? values.Length : values_.Length;

            for (int i = 0; i < size; i++)
            {
                values[i] = values_[i];
            }

            status = br.ufc.mdcc.hpc.storm.binding.channel.Binding.CompletedStatus.createStatus(status_root, source);
        }
 /// <summary>
 /// Determine whether this non-blocking operation has completed.
 /// </summary>
 /// <returns>
 /// If the non-blocking operation has completed, returns information
 /// about the completed communication operation. Otherwise, returns
 /// <c>null</c> to indicate that the operation has not completed.
 /// </returns>
 public CompletedStatus Test()
 {
     MPI.CompletedStatus internal_status = internal_request.Test();
     return(internal_status != null?CompletedStatus.createStatus(internal_status, source) : null);
 }
 /// <summary>
 /// Wait until this non-blocking operation has completed.
 /// </summary>
 /// <returns>
 ///   Information about the completed communication operation.
 /// </returns>
 public CompletedStatus Wait()
 {
     MPI.CompletedStatus internal_status = internal_request.Wait();
     return(CompletedStatus.createStatus(internal_status, source));
 }