Example #1
0
#pragma warning restore 649

        /// <summary>
        /// probably gets the count, who knows ...
        /// </summary>
        /// <param name="status"></param>
        /// <param name="datatype"></param>
        /// <returns></returns>
        public int GetCount(MPI_Status status, MPI_Datatype datatype)
        {
            int cnt, ierr;

            MPI_GET_COUNT(ref status, ref datatype, out cnt, out ierr);
            MPIException.CheckReturnCode(ierr);
            return(cnt);
        }
Example #2
0
#pragma warning restore 649

        /// <summary>
        /// Gets the Status of a Request, which is only meaningful, if request is freed.
        /// Probably that's not the case, when this method is invoked.
        /// <paramref name="isSetted"/> indicates completed request.
        /// </summary>
        /// <param name="request">input</param>
        /// <param name="isSetted">states if status is available</param>
        /// <param name="status">output</param>
        public void MPI_GetStatusOfRequest(MPI_Request request, out bool isSetted, out MPI_Status status)
        {
            int ierr, flag;

            MPI_REQUEST_GET_STATUS(ref request, out flag, out status, out ierr);
            isSetted = flag != 0;
            MPIException.CheckReturnCode(ierr);
        }
Example #3
0
        private void FixMPIStatus(ref MPI_Status st)
        {
            unsafe {
                Debug.Assert(sizeof(MPI_Status) <= 6 * sizeof(int), "implement higher schas");
                int NativeSize = this.MPI_Status_Size;
                if (NativeSize <= 5)
                {
                    st.i6 = 0;
                }
                else
                {
                    return;
                }

                if (NativeSize <= 4)
                {
                    st.i5 = 0;
                }
                else
                {
                    return;
                }

                if (NativeSize <= 3)
                {
                    st.i4 = 0;
                }
                else
                {
                    return;
                }

                if (NativeSize <= 2)
                {
                    st.i3 = 0;
                }
                else
                {
                    return;
                }

                if (NativeSize <= 1)
                {
                    st.i2 = 0;
                }
                else
                {
                    return;
                }
            }
        }
Example #4
0
#pragma warning restore 649

        /// <summary>
        ///
        /// </summary>
        public void Recv(IntPtr buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, out MPI_Status status)
        {
            int ierr;

            MPI_RECV(buf, ref count, ref datatype, ref source, ref tag, ref comm, out status, out ierr);
            FixMPIStatus(ref status);
            MPIException.CheckReturnCode(ierr);
        }
Example #5
0
#pragma warning restore 649

        /// <summary>
        ///
        /// </summary>
        /// <param name="count"></param>
        /// <param name="array_of_requests"></param>
        /// <param name="index"></param>
        /// <param name="status"></param>
        public void Waitany(int count, MPI_Request[] array_of_requests, out int index, out MPI_Status status)
        {
            int ierr;

            // note: since the status is passed by reference/pointer,
            // some larger buffer does not do any harm
            // (if our internal MPI_Status structure is larger than the one actually defined by the MPI-implementation)

            MPI_WAITANY(ref count, array_of_requests, out index, out status, out ierr);
            if (index != MiscConstants.UNDEFINED)
            {
                index--; // convert fortran index into C-index
            }
            MPIException.CheckReturnCode(ierr);
            FixMPIStatus(ref status);
        }