Пример #1
0
        /// <summary>
        /// Creates a new buffered scan operation.
        /// </summary>
        /// <typeparam name="T">The underlying type of the scan operation.</typeparam>
        /// <typeparam name="TScanOperation">The type of the scan operation.</typeparam>
        /// <param name="kind">The scan kind.</param>
        /// <returns>The created scan handler.</returns>
        public BufferedScan <T> CreateScan <T, TScanOperation>(
            ScanKind kind)
            where T : unmanaged
            where TScanOperation : struct, IScanReduceOperation <T>
        {
            var scan = Accelerator.CreateScan <T, TScanOperation>(kind);

            return((stream, input, output) =>
                   scan(stream, input, output, tempBuffer.View));
        }
Пример #2
0
        /// <summary>
        /// Creates a new buffered scan operation.
        /// </summary>
        /// <typeparam name="T">The underlying type of the scan operation.</typeparam>
        /// <typeparam name="TScanOperation">The type of the scan operation.</typeparam>
        /// <param name="kind">The scan kind.</param>
        /// <returns>The created scan handler.</returns>
        public BufferedScan <T> CreateScan <T, TScanOperation>(
            ScanKind kind)
            where T : unmanaged
            where TScanOperation : struct, IScanReduceOperation <T>
        {
            var scan = Accelerator.CreateScan <T, TScanOperation>(kind);

            return((stream, input, output) =>
            {
                var tempView = AllocateTempScanView(input);
                scan(stream, input, output, tempView);
            });
        }
Пример #3
0
        /// <summary>
        /// Creates a new buffered scan operation.
        /// </summary>
        /// <typeparam name="T">The underlying type of the scan operation.</typeparam>
        /// <typeparam name="TShuffleDown">The type of the shuffle logic.</typeparam>
        /// <typeparam name="TScanOperation">The type of the scan operation.</typeparam>
        /// <param name="kind">The scan kind.</param>
        /// <returns>The created scan handler.</returns>
        public BufferedScan <T, TShuffleDown, TScanOperation> CreateScan <T, TShuffleDown, TScanOperation>(
            ScanKind kind)
            where T : struct
            where TShuffleDown : struct, IShuffleDown <T>
            where TScanOperation : struct, IScanOperation <T>
        {
            var scan = Accelerator.CreateScan <T, TShuffleDown, TScanOperation>(kind);

            return((stream, input, output, shuffleDown, scanOperation) =>
            {
                var tempView = AllocateTempScanView(input);
                scan(stream, input, output, tempView, shuffleDown, scanOperation);
            });
        }