示例#1
0
 /// <summary>
 /// creates an empty Permutation (filled with invalid, negative entries)
 /// </summary>
 /// <param name="comm"></param>
 /// <param name="localLength">number of items that are stored in this process</param>
 public Permutation(int localLength, MPI.Wrappers.MPI_Comm comm)
     : this(new long[localLength], comm)
 {
     for (int i = 0; i < m_Values.Length; i++)
     {
         m_Values[i] = -1;
     }
 }
示例#2
0
        /// <summary>
        /// creates a permutation with user-defined entries;
        /// The "correctness" (each entry occurs exactly once over all processes,
        /// and the lowest entry is 0 an no number is skipped) is NOT tested;
        /// </summary>
        /// <param name="comm"></param>
        /// <param name="values">permutation values that are stored on this process</param>
        public Permutation(long[] values, MPI.Wrappers.MPI_Comm comm)
        {
            ilPSP.MPICollectiveWatchDog.Watch(comm);

            m_Values = values;

            m_Comm      = comm;
            m_Partition = new Partitioning(values.Length, comm);

#if DEBUG
            long max = m_Partition.TotalLength;
            int  I   = values.Length;
            for (int i = 0; i < I; i++)
            {
                if (values[i] < 0 || values[i] >= max)
                {
                    throw new ArgumentOutOfRangeException();
                }
            }
#endif

            //m_LocalLengths = new int[master.Size];
            //int[] ll = { values.Length };

            //unsafe {
            //    fixed (void* pSndBuf = ll, pRcvBuf = m_LocalLengths) {
            //        csMPI.Raw.Allgather((IntPtr) pSndBuf, 4, MPI_Datatype.BYTE,
            //                         (IntPtr) pRcvBuf, 4, MPI_Datatype.BYTE,
            //                         csMPI.Raw.MPI_COMM_WORLD);
            //    }
            //}

            //int size = m_Master.Size;
            //m_i0Offset = new long[size+1];
            //m_i0Offset[0] = 0;
            //for (int i = 1; i <= size; i++)
            //    m_i0Offset[i] = m_i0Offset[i-1] + m_LocalLengths[i-1];
            //m_TotalLength = m_i0Offset[size];
        }