Пример #1
0
        /// <summary>
        /// Split the aggregate device into smaller aggregate devices according to the
        /// specified <paramref name="partitionSizes"/>. For each nonzero count <em>m</em>
        /// in the list, a sub-device is created with <em>m</em> compute units in it.
        /// <para/>
        /// The number of non-zero count entries in the list may not exceed <see cref="PartitionMaxSubDevices"/>.
        /// The total number of compute units specified may not exceed <see cref="MaxComputeUnits"/>.
        /// </summary>
        /// <param name="partitionSizes">The size of the partitions to be created.</param>
        /// <returns>A collection of sub-devices representing the created partitions.</returns>
        public DisposableCollection <Device> Partition(params int[] partitionSizes)
        {
            if (partitionSizes == null)
            {
                throw new ArgumentNullException("partitionSizes");
            }
            if (partitionSizes.Length == 0)
            {
                throw new ArgumentException();
            }

            return(UnsafeNativeMethods.PartitionByCounts(ID, partitionSizes));
        }