Пример #1
0
        /// <summary>
        ///	Sends the payload message from the current thread to the thread
        ///	with the destination rank.  See MPI_Isend in the MPI2 API.
        /// </summary>
        /// <param name="destRank">The destination</param>
        /// <param name="payload">The message being sent</param>
        /// <param name="eager">
        /// When true, the instructions is automatically marked as complete when
        /// issued.  Thus an MpiWait on the handle returned will be a no-op.
        /// </param>
        /// <returns>
        ///	A handle on the send instruction that can be used with a function call
        ///	to <see cref="Wait(SendHandle)" />.
        /// </returns>
        public SendHandle SendAsync(int destRank, string payload, bool eager)
        {
            ValidateRankArgument("destRank", destRank);

            AssertProcessCanAccessMpiApi();
            Runtime.DetectCollectiveAbort();

            // Rule: P_S
            var instr = new AsyncSendInstruction(Process, Process.GetNextInstructionID(), destRank, payload, eager);

            Process.AddInstructionToHistory(instr);

            // Rule: R_SB - Eager (buffered) sends should automatically complete
            // as soon as the runtime has had an opportunity to do the buffering.
            // In this case, no actual buffering is needed for string data
            // in .net so just set the instructions to being completed
            //   Note: Setting these sends to being completed is different than
            // setting it as matched.  This instruction is not yet matched.  The
            // runtime is responsible for deciding which receive to match this
            // send with.
            if (eager)
            {
                instr.IsCompleted = true;
            }

            AddInstructionToPendingQueue(instr);
            Runtime.NotifyStateChanged();

            return(new SendHandle(instr));
        }
Пример #2
0
 internal SendHandle(AsyncSendInstruction instr) : base(instr)
 {
 }