Example #1
0
#pragma warning restore 649

        /// <summary>
        ///
        /// </summary>
        public void Gather(IntPtr sendbuf, int sendcount, MPI_Datatype sendtype, IntPtr recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)
        {
            int ierr;

            MPI_GATHER(sendbuf, ref sendcount, ref sendtype, recvbuf, ref recvcount, ref recvtype, ref root, ref comm, out ierr);
            MPIException.CheckReturnCode(ierr);
        }
Example #2
0
#pragma warning restore 649

        public void Scatterv(IntPtr sendbuf, IntPtr sendcounts, IntPtr displs, MPI_Datatype sendtype,
                             IntPtr recvbuf, int recvcount, MPI_Datatype recvtype,
                             int root, MPI_Comm comm)
        {
            MPI_SCATTERV(sendbuf, sendcounts, displs, ref sendtype, recvbuf, ref recvcount, ref recvtype, ref root, ref comm, out int ierr);
            MPIException.CheckReturnCode(ierr);
        }
Example #3
0
#pragma warning restore 649


        #region Group destructors
        /// <summary>
        ///
        /// </summary>
        public void Comm_Rank(MPI_Comm comm, out int rank)
        {
            int ierr;

            MPI_COMM_RANK(ref comm, out rank, out ierr);
            MPIException.CheckReturnCode(ierr);
        }
Example #4
0
#pragma warning restore 649

        /// <summary>
        ///
        /// </summary>
        public void Comm_Size(MPI_Comm comm, out int size)
        {
            int ierr;

            MPI_COMM_SIZE(ref comm, out size, out ierr);
            MPIException.CheckReturnCode(ierr);
        }
Example #5
0
#pragma warning restore 649

        /// <summary>
        ///
        /// </summary>
        public void Bcast(IntPtr buf, int count, MPI_Datatype datatype, int root, MPI_Comm comm)
        {
            int ierr;

            MPI_BCAST(buf, ref count, ref datatype, ref root, ref comm, out ierr);
            MPIException.CheckReturnCode(ierr);
        }
Example #6
0
#pragma warning restore 649

        /// <summary>
        ///
        /// </summary>
        public void Barrier(MPI_Comm comm)
        {
            int ierr;

            MPI_BARRIER(ref comm, out ierr);
            MPIException.CheckReturnCode(ierr);
        }
Example #7
0
#pragma warning restore 649

        /// <summary>
        ///
        /// </summary>
        public void Send(IntPtr buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)
        {
            int ierr;

            MPI_SEND(buf, ref count, ref datatype, ref dest, ref tag, ref comm, out ierr);
            MPIException.CheckReturnCode(ierr);
        }
Example #8
0
#pragma warning restore 649

        /// <summary>
        /// ~
        /// </summary>
        public void Cancel(ref MPI_Request r)
        {
            int ierr;

            MPI_CANCEL(ref r, out ierr);
            MPIException.CheckReturnCode(ierr);
        }
Example #9
0
#pragma warning restore 649

        /// <summary>
        ///
        /// </summary>
        unsafe public void Allreduce(IntPtr sndbuf, IntPtr rcvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
        {
            int ierr;

            MPI_ALLREDUCE(sndbuf, rcvbuf, ref count, ref datatype, ref op, ref comm, out ierr);
            MPIException.CheckReturnCode(ierr);
        }
Example #10
0
#pragma warning restore 649

        /// <summary>
        ///
        /// </summary>
        public void Comm_get_parent(out MPI_Comm parent)
        {
            int ierr;

            MPI_COMM_GET_PARENT(out parent, out ierr);
            MPIException.CheckReturnCode(ierr);
        }
Example #11
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 #12
0
#pragma warning restore 649

        /// <summary>
        ///
        /// </summary>
        public void Reduce(IntPtr sndbuf, IntPtr rcvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm)
        {
            using (new MPITracer()) {
                int ierr;
                MPI_REDUCE(sndbuf, rcvbuf, ref count, ref datatype, ref op, ref root, ref comm, out ierr);
                MPIException.CheckReturnCode(ierr);
            }
        }
Example #13
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="count"></param>
        /// <param name="array_of_requests"></param>
        /// <param name="array_of_statii"></param>
        public void Waitall(int count, MPI_Request[] array_of_requests, MPI_Status[] array_of_statii)
        {
            int ierr;

            MPI_WAITALL(ref count, array_of_requests, array_of_statii, out ierr);
            FixMPI_Status(array_of_statii);
            MPIException.CheckReturnCode(ierr);
        }
Example #14
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 #15
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 #16
0
#pragma warning restore 649

        public void Gatherv(IntPtr sendbuf, int sendcount, MPI_Datatype sendtype,
                            IntPtr recvbuf, IntPtr recvcounts, IntPtr displs, MPI_Datatype recvtype,
                            int root, MPI_Comm comm)
        {
            using (new MPITracer()) {
                MPI_GATHERV(sendbuf, ref sendcount, ref sendtype, recvbuf, recvcounts, displs, ref recvtype, ref root, ref comm, out int ierr);
                MPIException.CheckReturnCode(ierr);
            }
        }
Example #17
0
#pragma warning restore 649

        /// <summary>
        ///
        /// </summary>
        public void Allgatherv(IntPtr sendbuf, int sendcount, MPI_Datatype sendtype,
                               IntPtr recvbuf, IntPtr recvcounts, IntPtr displs, MPI_Datatype recvtype,
                               MPI_Comm comm)
        {
            int ierr;

            MPI_ALLGATHERV(sendbuf, ref sendcount, ref sendtype, recvbuf, recvcounts, displs, ref recvtype, ref comm, out ierr);
            MPIException.CheckReturnCode(ierr);
        }
Example #18
0
#pragma warning restore 649

        /// <summary>
        /// see MPI reference;
        /// </summary>
        /// <returns></returns>
        public bool Initialized()
        {
            int flag = 0;
            int ierr;

            MPI_INITIALIZED(ref flag, out ierr);
            MPIException.CheckReturnCode(ierr);
            return(flag != 0);
        }
Example #19
0
#pragma warning restore 649

        /// <summary>
        ///
        /// </summary>
        public void Allgather(IntPtr sendbuf, int sendcount, MPI_Datatype sendtype,
                              IntPtr recvbuf, int recvcount, MPI_Datatype recvtype,
                              MPI_Comm comm)
        {
            using (new MPITracer()) {
                int ierr;
                MPI_ALLGATHER(sendbuf, ref sendcount, ref sendtype, recvbuf, ref recvcount, ref recvtype, ref comm, out ierr);
                MPIException.CheckReturnCode(ierr);
            }
        }
Example #20
0
#pragma warning restore 649

        /// <summary>
        ///
        /// </summary>
        public void Irecv(IntPtr buf, int count, MPI_Datatype datatype,
                          int source, int tag,
                          MPI_Comm comm,
                          out MPI_Request request)
        {
            int ierr;

            MPI_IRECV(buf, ref count, ref datatype, ref source, ref tag, ref comm, out request, out ierr);
            MPIException.CheckReturnCode(ierr);
        }
Example #21
0
 /// <summary>
 /// MPI finalize
 /// </summary>
 public void mpiFinalize()
 {
     if (isFinalized)
     {
         Console.WriteLine("Warning: MPI finalization called multiple times.");
         return;
     }
     isFinalized = true;
     MPIException.CheckReturnCode(MPI_Finalize());
 }
Example #22
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);
        }
Example #23
0
#pragma warning restore 649

        /// <summary>
        /// see MPI reference;
        /// </summary>
        /// <param name="args">
        /// command line args passed to the application
        /// </param>
        /// <remarks>
        /// Do not call this directly, use ilPSP.Enviroment.Bootstrap instead.
        /// </remarks>
        public void Init(string[] args)
        {
            IntPtr[] argsAnsi = new IntPtr[Math.Max(args.Length, 1)];

            for (int i = 0; i < args.Length; i++)
            {
                argsAnsi[i] = Marshal.StringToCoTaskMemAnsi(args[i]);
            }

            unsafe
            {
                fixed(void *argv = &(argsAnsi[0]))
                {
                    void *_argv = argv;
                    int   argc  = args.Length;

                    if (dirrtyMpiInitHack == 1)
                    {
                        MPIException.CheckReturnCode(OpenMPI_MPI_Init1(&argc, (byte ***)(&_argv)));
                    }
                    else if (dirrtyMpiInitHack == 2)
                    {
                        MPIException.CheckReturnCode(OpenMPI_MPI_Init2(&argc, (byte ***)(&_argv)));
                    }
                    else
                    {
                        MPIException.CheckReturnCode(MPI_Init(&argc, (byte ***)(&_argv)));
                    }
                }
            }

            foreach (IntPtr p in argsAnsi)
            {
                Marshal.FreeCoTaskMem(p);
            }
        }
Example #24
0
#pragma warning restore 649

        /// <summary>
        /// MPI finalize
        /// </summary>
        public void mpiFinalize()
        {
            MPIException.CheckReturnCode(MPI_Finalize());
        }