/// <summary> /// ctor. /// </summary> /// <param name="master"></param> /// <param name="vector">a vector of length J*<paramref name="ItemsPerCell"/>, where J is the number of local cells (including ghost)</param> /// <param name="ItemsPerCell">the number of items that should be transmitted/received per cell</param> public VectorTransceiver(IGridData master, T vector, int ItemsPerCell) { CheckItemTypeRecursive(typeof(V)); int J = master.iLogicalCells.Count; if (vector.Count != ItemsPerCell * J) { throw new ArgumentException("wrong length of input vector."); } m_ItemsPerCell = ItemsPerCell; m_vector = vector; m_master = master; //sms = new SerialisationMessenger(csMPI.Raw._COMM.WORLD); //// set comm. paths //sms.SetCommPathsAndCommit(master.Parallel.ProcessesToSendTo); var Para = m_master.iParallel; var sndProc = Para.ProcessesToSendTo; var rvcProc = Para.ProcessesToReceiveFrom; SendBuffers = new V[sndProc.Length][]; for (int i = 0; i < SendBuffers.Length; i++) { int p = sndProc[i]; SendBuffers[i] = new V[Para.SendCommLists[p].Length * m_ItemsPerCell]; } SendBufferPin = new GCHandle[sndProc.Length]; rqst = new MPI_Request[sndProc.Length + rvcProc.Length]; staTussies = new MPI_Status[rqst.Length]; if (!(typeof(T).IsArray)) { RcvBuffer = new V[rvcProc.Length][]; for (int i = 0; i < RcvBuffer.Length; i++) { int p = rvcProc[i]; RcvBuffer[i] = new V[Para.RcvCommListsNoOfItems[p] * m_ItemsPerCell]; } RcvBufferPin = new GCHandle[RcvBuffer.Length]; } }
/// <summary> /// ctor /// </summary> /// <param name="comm"></param> //// <typeparam name="t">the primitive type of the message; must be a value-type;</typeparam> public Many2ManyMessenger(MPI.Wrappers.MPI_Comm comm) { m_Comm = comm; MPI.Wrappers.csMPI.Raw.Comm_Size(m_Comm, out size); MPI.Wrappers.csMPI.Raw.Comm_Rank(m_Comm, out MyRank); m_MyCommPaths = new int[size]; m_AllCommPaths = new int[size, size]; m_ReceiveBuffers = new Buffer[size]; m_SendBuffers = new Buffer[size]; m_Requests = new MPI_Request[size * 2]; m_ArrayOfStatuses = new MPI_Status[m_Requests.Length]; // check item type m_ItemType = typeof(ItemType); CheckItemTypeRecursive(m_ItemType); m_ItemSize = Marshal.SizeOf(m_ItemType); }
public static unsafe extern int MPI_Testsome(int incount, MPI_Request[] array_of_requests, out int outcount, int[] array_of_indices, MPI_Status[] array_of_statuses);
public static unsafe extern int MPI_Probe(int source, int tag, MPI_Comm comm, out MPI_Status status);
public static unsafe extern int MPI_Waitall(int count, MPI_Request* array_of_requests, MPI_Status[] array_of_statuses);
public static unsafe extern int MPI_Testall(int count, MPI_Request* array_of_requests, out int flag, MPI_Status[] array_of_statuses);
public static unsafe extern int MPI_Test(ref MPI_Request request, out int flag, out MPI_Status status);
public static unsafe extern int MPI_Testany(int count, MPI_Request[] array_of_requests, out int index, out int flag, out MPI_Status status);
public static unsafe extern int MPI_Wait(ref MPI_Request request, out MPI_Status status);
public static unsafe extern int MPI_Get_count(ref MPI_Status status, MPI_Datatype datatype, out int count);
public static unsafe extern int MPI_Test_cancelled(ref MPI_Status status, out int flag);
public static unsafe extern int MPI_Sendrecv(IntPtr sendbuf, int sendcount, MPI_Datatype senddatatype, int dest, int sendtag, IntPtr recvbuf, int recvcount, MPI_Datatype recvdatatype, int source, int recvtag, MPI_Comm comm, out MPI_Status status);
public static unsafe extern int MPI_Recv(IntPtr buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, out MPI_Status status);