Пример #1
0
        /// <summary>
        ///   Adopts a low-level MPI group that was created with any of the low-level MPI facilities.
        ///   The resulting <c>Group</c> object will manage the lifetime of the low-level MPI group,
        ///   and will call <see cref="Unsafe.MPI_Group_free"/> when it is disposed or finalized.
        /// </summary>
        /// <remarks>
        ///   This constructor should only be used in rare cases where the program 
        ///   is manipulating MPI groups through the low-level MPI interface.
        /// </remarks>
        public static Group Adopt(MPI_Group group)
        {
            if (group == Unsafe.MPI_GROUP_NULL)
                return null;

            Group result = new Group();
            result.group = group;
            return result;
        }
Пример #2
0
 /// <summary>
 ///   Compare two MPI groups.
 /// </summary>
 /// <list>
 ///   <listheader>
 ///     <term>Value</term>
 ///     <description>Description</description>
 ///   </listheader>
 /// <item>
 ///   <term><see cref="Comparison.Identical"/></term>
 ///   <description>The two <c>Group</c> objects represent the same group.</description>
 /// </item>
 /// <item>
 ///   <term><see cref="Comparison.Congruent"/></term>
 ///   <description>
 ///     The two <c>Group</c> objects contain the same processes with the same ranks,
 ///     but represent different groups.
 ///   </description>
 /// </item>
 /// <item>
 ///   <term><see cref="Comparison.Similar"/></term>
 ///   <description>
 ///     The two <c>Group</c> objects contain the same processes, but with different ranks.
 ///   </description>
 /// </item>
 /// <item>
 ///   <term><see cref="Comparison.Unequal"/></term>
 ///   <descsription>The two <c>Group</c> objects are different.</descsription>
 /// </item>
 /// </list>      
 public Comparison Compare(Group other)
 {
     int result;
     unsafe
     {
         int errorCode = Unsafe.MPI_Group_compare(group, other.group, out result);
         if (errorCode != Unsafe.MPI_SUCCESS)
             throw Environment.TranslateErrorIntoException(errorCode);
     }
     return Unsafe.ComparisonFromInt(result);
 }
Пример #3
0
 /// <summary>
 ///   Translates the ranks of processes in this group to the ranks of the same processes within a different group.
 /// </summary>
 /// <param name="ranks">The rank values in this group that will be translated.</param>
 /// <param name="other">The group whose ranks we are translating to.</param>
 /// <returns>
 ///   An integer array containing the ranks of the processes in <paramref name="other"/> that correspond to
 ///   the ranks of the same processes in this group. For processes that are in this group but not 
 ///   <paramref name="other"/>, the resulting array will contain <see cref="Group.NoProcess"/>.
 /// </returns>
 public int[] TranslateRanks(int[] ranks, Group other)
 {
     int[] result = new int[ranks.Length];
     unsafe
     {
         int errorCode = Unsafe.MPI_Group_translate_ranks(group, ranks.Length, ranks, other.group, result);
         if (errorCode != Unsafe.MPI_SUCCESS)
             throw Environment.TranslateErrorIntoException(errorCode);
     }
     return result;
 }