Пример #1
0
        public void SumScanJobTest()
        {
            int[] array = new int[ARRAY_COUNT];
            for (int i = 0; i < ARRAY_COUNT; i++)
            {
                array[i] = GenerateRandomInt();
            }

            NativeArray <int> na_array   = new NativeArray <int>(array, Allocator.TempJob);
            SumScanJob        sumScanJob = new SumScanJob(ref na_array);

            sumScanJob.InclusiveSumScan();

            // using serial inclusive sum scan method to make sure that the parallel method works
            int sum = 0;

            for (int i = 0; i < ARRAY_COUNT; i++)
            {
                sum += array[i];
                Assert.AreEqual(sum, na_array[i]);
            }

            na_array.Dispose();
            sumScanJob.Dispose();
        }
Пример #2
0
 public void Dispose()
 {
     na_sortedValues.Dispose();
     na_sortedIndices.Dispose();
     na_bit.Dispose();
     na_truePrefixSum.Dispose();
     na_falsePrefixSum.Dispose();
     trueSumScanJob.Dispose();
     falseSumScanJob.Dispose();
 }